-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable NAK Delay at the Consumer Level #6311
Comments
Would it work to have the existing backoff configuration also apply to NAK? |
Maybe, but existing backoff configuration relies on MaxDelivery, and there's (of course) no such thing for NAK. |
A NAK is a delivery attempt so MaxDelivery counts on NAKs. Adding a new setting is a huge undertaking especially one thats quite close in behaviour to something else - We have received feedback, a lot of it, that NAKs should be subject to backoff also so that seems a more likely approach |
You are absolutely right about MaxDelivery applying to NAKs (my mistake reading the docs). |
As we have NAK with a custom delay you could assume that the backoff won't apply if a delay is given, so if you want non default backoff managed NAK just give a delay of your own. Anyway, just a thought that backoff might work |
Yes, I am thinking about cases where no custom delay is passed, and immediate redelivery is expected. Also, since in my scenario there is a dependency on external services, I was considering that it might be useful to differentiate the backoffs between timeouts (internal issues) and NAKs (external issues). But probably it’s not a big deal, and I’m just overthinking it — you’re probably correct |
Proposed change
Currently, when a NAK is sent for a message, the only way to avoid immediate redelivery is by using nakDelay (nakWithDelay in my case as I'm using java). While this functionality works, it requires specifying the delay programmatically each time a NAK is issued.
There is no way to configure a delay for NAKs at the consumer level. I think it's a limitation, especially when multiple consumers need a consistent delay for NAKs.
Proposal:
Introduce a configuration option at the consumer level to define a default NAK delay. For example, it maybe similar to how backoff can be configured for timeouts, defining a backoffNak, and also a defaultNakDelay parameter could allow users to specify a fixed delay for all NAKs issued by the consumer. This configuration would slightly simplify code for handling NAKs and, more importantly, it will ensure consistent behavior across consumers.
Use case
Consider a scenario where a consumer processes messages and the client(s) occasionally needs to send a NAK due to transient issues (e.g., external service unavailability): by configurig a NAK delay at the consumer level, the delay configuration can be managed centrally allowing adjustments to respond to external variables, such as errors or timeouts from external services (for example we can have a 1 second NAK delay, but if we know that an external service is intermittently unavailable or down for several minutes, the NAK delay can be increased to 60 seconds or more, minimizing network traffic and avoiding unnecessary message retries every second).
Additionally, this approach allows operators to modify the delay (e.g., making it incremental or adjusting it to changing requirements) directly at the server configuration level without requiring redeployment of client applications. This provides greater flexibility and reduces operational overhead in dynamic environments.
Contribution
No response
The text was updated successfully, but these errors were encountered: