Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Support Nack functionality for avoiding loosing messages on errors #3371

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

AvitalOfstein
Copy link

Pull Request type

  • Feature

Changes in this PR

Describe the new behavior from this PR, and why it's needed
Support Nack functionality for avoiding loosing messages when handling messages and getting unexpected errors

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
… - supporting cases of transient failures, that messages we can't process- won't be lost by ack, and not re-published back to the queue, but published to DLQ (in some queue implementation).
@@ -134,6 +134,10 @@ public void handle(ObservableQueue queue, Message msg) {
queue.publish(Collections.singletonList(msg));
LOGGER.debug("Message: {} published to queue: {}", msg.getId(), queue.getName());
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AvitalOfstein , Thanks for submitting the PR. Should we also need to change the logic at line 127 to not ack when executionFailed is true?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @manan164, Yes, but we would prefer to split the executionFailed issue handling to different PR (bug fix), from this one (adding Nack feature), since there are already many users of this code, with different queue types, and we wouldn't like to cause potential regression in changing the conditions in this logic in the same PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @AvitalOfstein , could you explain what the nack will do? The default implementation is empty. It would also help to which queue implementation are you planning to use nack with.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aravindanr ,
Sure, in case we have an error while processing the event (e.g. line 194), it won't get into the first 2 conditions (queue.ack and queue.publish).
In RabbitMQ implementation, the consumner will do nothing with the message (will be idle) and after some time it will get disconnected.
So in AMQP implementation (community repo) I would like to add the specific implementation of Nack with possibility not to requeue (so it can go to DLQ if defined), other implementations can keep with current behavior.

@github-actions
Copy link
Contributor

This PR is stale, because it has been open for 45 days with no activity. Remove the stale label or comment, or this will be closed in 7 days.

@manan164
Copy link
Contributor

manan164 commented Mar 2, 2023

Hi @aravindanr , can you please review the changes? cc @AvitalOfstein

@v1r3n v1r3n merged commit f8cae81 into Netflix:main Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants