<html><head>
<meta http-equiv="content-type" content="text/html; charset=us-ascii">
<title>Re: [rabbitmq-discuss] Fault-tolerant subscriptions using the .NET
client</title>
</head><body>Hi Emile,<br>
<br>
Thank
 you for your prompt response. I agree that my current solution doesn't 
appear optimal. I am hoping that your suggestion will lead me down the road 
to something that is more fitting. Having said that, a few seconds of delay 
in checking the state of the connection isn't totally abhorrent for the use 
case in question, so even if I don't manage to find another way, the one I 
have now works and hits the requirement.<br>
<br>
I will be looking into your 
suggestion as instant notification and connection/subscription 
re-establishment would be nice to have.<br>
<br>
I am surprised to hear that 
the Dispose() method is called when the connection is broken yet subsequent 
calls to subscription.Next() continue to function and return 'true'. This 
seems a little counter-intuitive to me. I would expect that attempting to 
called Next() on a subscription that has been disposed would result in some 
kind of error.<br>
<br>
I will investigate further at some point today. Thanks again for taking the
time to respond.<br>
<br>
Best regards<br>
OJ<br>
<br>
<div class="gmail_quote">On 25 March 2011 23:55, Emile Joubert <span
dir="ltr">&lt;emile@rabbitmq.com&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex;">Hi OJ,<div class="im"><br>
<br>
On 25/03/11 12:17, OJ Reeves wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
Hi again,<br>
<br>
After a bit of investigation and information from a friend, I went down<br>
the path of periodically checking the IsOpen property on the Connection<br>
object. If false, then I go through the process of attempting to<br>
re-establish the connection.<br>
<br>
Is this a valid approach? Is it the recommended approach?<br>
</blockquote>
<br>
</div>
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.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
 &#160; &#160;If I simulate a network issue by stopping the RabbitMQ
server, the<br>
 &#160; &#160;subscriber is not informed about the connection loss.<br>
</blockquote>
<br>
</div>
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.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">
 &#160; &#160;What I would like to do is put something in place which is
able to<br>
 &#160; &#160;detect a connection failure and get things working again.<br>
</blockquote>
<br>
</div>
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:<br>
<a href="http://hg.rabbitmq.com/rabbitmq-dotnet-messagepatterns/"
target="_blank">http://hg.rabbitmq.com/<wbr>rabbitmq-dotnet-<wbr
>messagepatterns/</a><br>
<br>
This assume that a new subscription gets established if the connection
breaks.<br>
<br>
<br>
Regards<br>
<font color="#888888">
<br>
<br>
Emile<br>
<br>
</font></blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<br>
OJ Reeves<br>
http://buffered.io/<br>
</body></html>