<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2013/9/23 Mike Hadlow <span dir="ltr"><<a href="mailto:mike@suteki.co.uk" target="_blank">mike@suteki.co.uk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Does the channel concept exist only to support multi-threaded applications, or does it have some other purpose?</div>
</blockquote><div><br></div><div>It was added to avoid having N TCP connections from the same client in case it needs to have multiple logical connections.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div></div><div>If I marshal all calls to a channel onto a single thread in my application code, is there any problem with simply maintaining a single channel for all declares, publishes and consumes?</div></blockquote><div>
<br></div><div>Should be fine.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div>
<div>Additional questions:</div><div><br></div><div>1. Should each basic consume be invoked on a dedicated channel?</div></blockquote><div><br></div><div>If you want to have N consumers from the same OS process, it's not strictly necessary.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>2. Do I need to basic.ack on the same channel on which I invoked basic.consume?</div></blockquote>
</div><br></div><div class="gmail_extra">You must ack/nack/reject on the same channel the delivery was on because delivery_tag is<br></div><div class="gmail_extra">scoped per channel.<br><br></div><div class="gmail_extra">
A good reason to use more than one channel is error handling, which in many cases is per-channel.<br></div><div class="gmail_extra">For example, if you expect an exception for one operation that you can recover from, you can use<br>
a separate channel to make sure the connection closure caused by the exception does not affect other operations in the same VM.<br></div><div class="gmail_extra">-- <br>MK<br><br><a href="http://github.com/michaelklishin" target="_blank">http://github.com/michaelklishin</a><br>
<a href="http://twitter.com/michaelklishin" target="_blank">http://twitter.com/michaelklishin</a><br>
</div></div>