Loop on connecting to receiver - RabbitMQ connection failed
See original GitHub issueHello,
We just faced some strange problem. We configured rabbit with retry policy so after 5 tries it should abandon. We are using rabbitMq transport (default one). When application and bus is starting and rabbitMq is not running (you can simply stop service for testing purpose) it just keeps trying to connect (we had 300 mb of logs with information that mass transit is unable to connect to queue with message RabbitMQ connection failed: Connect failed: guest@localhost:5672/).
Is there any place where we can configure retry policy when trying to connect? Because i understand that receive endpoint configuration with retry policy simply sets retry policy when trying to receive message not when trying to connect. Am i right?
BusControl = Bus.Factory.CreateUsingRabbitMq(x =>
{
var host = x.Host(new Uri(_configuration.QueueAddress), h =>
{
h.Username(_configuration.UserName);
h.Password(_configuration.Password);
});
x.ReceiveEndpoint(host, "Test",
e =>
{
e.Instance(new TestConsumer(this));
e.UseRetry(Retry.Exponential(5, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(100),
TimeSpan.FromSeconds(6)));
});
});
BusControl.Start();
The loop occurs in PipeRetryExtensions RetryUntilCancelled which is called in Receiver method in RabbitMqReceiveTransport (https://github.com/MassTransit/MassTransit/blob/625c2afb4130bc7c24238d0480adb6845234acf9/src/MassTransit.RabbitMqTransport/Transport/RabbitMqReceiveTransport.cs#L101)
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)

Top Related StackOverflow Question
So I tested this and my console app exited with a could not connect error after less than a minute. So the old version is likely the culprit.
ok just rechecked and it seems that in 3.5.2 it does not occur. Thanks and sorry for bothering.