I need to implement a retry policy for an incoming message queue containing thousands of relatively small messages.
Successfully processed messages should be immediately removed from the queue.
If an error occurs while processing a message, the message should be sent back at the end of the queue, and the pause before re-processing this message should increase geometrically (1-2-4-8-16 seconds, and so on). In languages that support the async/await pattern, I'd simply create a delayed timer that triggers a fire-and-forget task. This would prevent blocking the main thread.
.png)
.png)
.png)
.png)