[rabbitmq-discuss] Fault-tolerant subscriptions using the .NET client

Emile Joubert emile at rabbitmq.com
Fri Mar 25 13:55:03 GMT 2011


Hi OJ,

On 25/03/11 12:17, OJ Reeves wrote:
> Hi again,
>
> After a bit of investigation and information from a friend, I went down
> the path of periodically checking the IsOpen property on the Connection
> object. If false, then I go through the process of attempting to
> re-establish the connection.
>
> Is this a valid approach? Is it the recommended approach?

That doesn't sound optimal. Ideally you want a solution that will notice 
as soon as a network error occurs. Your solution would introduce a delay 
during which the connection might be down, but IsOpen has not been 
called yet.

>     If I simulate a network issue by stopping the RabbitMQ server, the
>     subscriber is not informed about the connection loss.

The subscriber is notified by being disposed. You should find that the 
Dispose() method on Subscription gets called as soon as a connection 
error occurs.

>     What I would like to do is put something in place which is able to
>     detect a connection failure and get things working again.

A possible solution is to wrap some reconnection logic around connection 
establishment. Another would be to make use of the higher-level 
reconnection features in the messaging patterns library:
http://hg.rabbitmq.com/rabbitmq-dotnet-messagepatterns/

This assume that a new subscription gets established if the connection 
breaks.


Regards


Emile



More information about the rabbitmq-discuss mailing list