feat: MQ redelivery with backoff and maximum attempts #851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Two new queues are added: redelivery and wait.
The 'redelivery' queue is configured as the 'dead-letter-queue' for all queues in Orb. When a message is rejected by a subscriber, it is automatically sent to the 'redelivery' queue. The first time a message is rejected, the redelivery handler immediately redelivers the message to the original destination queue. If the message is rejected again, it is posted to a 'wait' queue and is given an expiration. The 'wait' queue has no subscribers, so the message will sit there until it expires.
The 'redelivery' queue is also configured as the 'dead-letter-queue' for the 'wait' queue, so when the message expires, it is automatically sent back to the 'redelivery' queue and this handler processes the message again. If the message metadata, 'reason', is set to "expired" then it is posted to the original destination queue, otherwise (if reason is "rejected") it is posted back to the 'wait' queue with a bigger expiration. This process repeats until the maximum number of redelivery attempts has been reached, at which point redelivery for the message is aborted.
This PR also fixes some BDD tests that failed because of timing.
closes #803
Signed-off-by: Bob Stasyszyn Bob.Stasyszyn@securekey.com