I have a dockerized microservice architecture where I am using Rebus with RabbitMQ as message bus.
One container is running RabbitMQ. Other containers are running services that communicate with each other via Rebus/RabbitMQ.
I want my solution to be resilient to container restarts so if for example the RabbitMQ container restarts I expect the other services to be unaffected by that. I expect that messages sent while RabbitMQ is down are queued up for delivery by Rebus in the sending service and that they are delivered when the RabbitMQ connection is restored.
To verify that I run this test scenario:
- Service A sends a message to service B via Rebus and RabbitMQ. That works fine.
- I stop the RabbitMQ container.
- Service A sends a message to service B via Rebus and RabbitMQ. That fails because RabbitMQ is unavailable.
- I start the RabbitMQ container again.
- I can see that Rebus in my services automatically reconnect to RabbitMQ when it is up. That is as expected.
- Now that the RabbitMQ connection is restored I would expect that Rebus sends the pending message from Service A to service B, but it does not.
Is this not expected behaviour of Rebus? If not, can I enable this feature?
I have read this topic https://github.com/rebus-org/Rebus/wiki/Automatic-retries-and-error-handling and tried to configure Rbus like this:
Configure.With(...)
.Options(b => b.SimpleRetryStrategy(maxDeliveryAttempts: 10))
.(...)
but with no luck.