Delay a retry by X seconds
hannesvdvreken opened this issue · 1 comments
Is there a feature to handle errors from a handler, so that the Bus sends the message back to the queue, but with a specific delay (cfr the SQS visibility timeout).
The use case:
a Rate Limit is hit while getting a single item from an API. Based on the rate limit response headers you can calculate exactly how long you need to back off.
Is there a specific feature one can use to do this? Right now the error happens in the handler and the message gets sent back to the queue. The workers retry X times and then the message gets discarded.
I'm looking at the docs but haven't seen anything interesting to solve it.
The only thing I can think of is the onError lifecycle hook, but I'm not sure if you can modify the RawMessage to add a delay.
Any advice is greatly appreciated!
This feature doesn't exist yet but is definitely on the table. The idea is to allow consumers to provide a RetryStrategy
where you can write your own rules on how long to retry, and maybe provide some prebuilt ones like ExponentialBackoff
or JitterLinearBackoff
etc.
I'll use this issue to track it, thanks for raising it.