<div>I appreciate the guidance that you shouldn&#39;t call IModel.Close() from a shutdown callback due to the way the code is currently designed, but I submit that this is a design flaw within the .Net client and that ideally you should be able to do this.</div>

<div><br></div><div>As far as considering connection renewal rather than channel renewal, I don&#39;t understand how this would be possible. You yourself said:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><i>&quot;It is not possible to maintain the previous subscription to the broker</i></span></div><div><i><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">and somehow inject a new channel and/or connection into it.�</span><span class="il" style="background-color:rgb(255,255,204);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">You</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">�will</span></i></div>
<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><i>need to re-establish all contained channels and all associated</i></span></div><div><i><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">subscriptions�</span><span class="il" style="background-color:rgb(255,255,204);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px">when</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">�the connection shuts down.&quot;</span></i></div>
</blockquote><div><br></div><div><br></div><div>If I&#39;m misunderstanding what you mean by this, please provide a bit more detail as to what you&#39;re referring to.</div><div><br></div><div><br></div><div>Currently, I&#39;m working around the issue with the following code:</div>
<div><br></div><div><div>// ------------------------------------------------------------------------------------------</div><div>// Closing/disposing channels on IConnection.ConnectionShutdown causes a deadlock, so</div><div>
// the ISession.SessionShutdown event is used here to infer a connection shutdown.�</div><div>// ------------------------------------------------------------------------------------------</div><div>((ConnectionBase) connection).m_session0.SessionShutdown += UnexpectedConnectionShutdown;</div>
</div><div><br></div>
<div>This obviously isn&#39;t ideal, as the SessionShutdown isn&#39;t intended to be part of the public API. �I also not completely sure why it works, I just know that it�satisfies�my�integration�test suite.</div><div><br>
</div><div>Again, the problem I&#39;m trying to address is to model a Subscription which can be cancelled on demand (i.e. the user wants to maintain the connection, but wants to unsubscribe from receiving a given message type), and which can be renewed when a new connection is obtained. �Using the IModel.ModelShutdown event here isn&#39;t what someone would want to do from a design perspective, as there are things I want to do on connection shutdown that I don&#39;t want to do on every model shutdown. �It just simply isn&#39;t the right event for the case at hand. �I also can&#39;t just not call IModel.Close() in all cases.</div>
<div><br></div><div>Bottom line, I see a design flaw here that needs to be recognized and addressed. �</div><div><br></div><div>Speaking of which, this mailing list is a horrible way to deal with product specific bug reports. �Why doesn&#39;t your team use github or some other facility which has a proper bug tracking system?</div>
<div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><br><div class="gmail_quote">
On Fri, Sep 21, 2012 at 9:25 AM, Emile Joubert <span dir="ltr">&lt;<a href="mailto:emile@rabbitmq.com" target="_blank">emile@rabbitmq.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Hi Derek,<br>
<div><br>
On 21/09/12 14:59, Derek Greer wrote:<br>
&gt; I&#39;m wanting to loop through all my<br>
&gt; Subscription instances and call Renew() after I have a new connection.<br>
&gt; �Part of the Renew() logic is to stop the current thread, and part of the<br>
&gt; normal course of stopping is to attempt to close the channel/model.<br>
<br>
</div>You shouldn&#39;t close the channel/IModel from within a shutdown callback.<br>
Also consider performing connection re-establishment rather than channel<br>
re-establishment/renewal.<br>
<span><font color="#888888"><br>
-Emile<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><font face="georgia, serif" color="#c0c0c0">___________________________________________</font></div><font color="#333300" face="verdana, sans-serif"><span style><span style="color:rgb(51,51,0)">Derek Greer</span></span></font><div>

<a href="mailto:dbgreer@gmail.com" style="font-family:&#39;times new roman&#39;,serif" target="_blank">dbgreer@gmail.com</a><span style="color:rgb(51,51,255);font-family:&#39;times new roman&#39;,serif">� � �|�</span><a href="http://twitter.com/derekgreer" style="font-family:&#39;times new roman&#39;,serif" target="_blank">@derekgreer</a>
</div><div><span style="color:rgb(51,51,255);font-family:&#39;times new roman&#39;,serif"><a href="http://derekgreer.lostechies.com/" target="_blank">lostechies.com</a></span><span style="color:rgb(51,51,255);font-family:&#39;times new roman&#39;,serif">�</span><span style="color:rgb(51,51,255);font-family:&#39;times new roman&#39;,serif">|</span><span style="color:rgb(51,51,255);font-family:&#39;times new roman&#39;,serif">�</span><font color="#3333ff"><font face="&#39;times new roman&#39;, serif"><a href="http://derekgreer.freshbrewedcode.com" target="_blank">freshbrewedcode.com</a>�</font><span style="font-family:&#39;times new roman&#39;,serif">| <a href="http://aspiringcraftsman.com" target="_blank">aspiringcraftsman.com</a></span></font></div>

<div><div><div><span style="color:rgb(192,192,192);font-family:georgia,serif">___________________________________________</span><font color="#333300" face="georgia, serif"><br></font><div><div><div><font color="#666666" face="&#39;times new roman&#39;, serif"><br>

</font></div></div></div></div></div></div><br>