<div dir="ltr">Hi, <div>I want to design a rabbit client framework to my project using Rabbitmq Java client.</div><div>My goals it to set default behaviour for other team members using Rabbit.</div><div><br></div><div>Rabbit In Action eBook (chapter 6 "Writing code that survive failures") recommends the following <br>
</div><div>1. wrap all code in try catch</div><div>2. wrap all in while true</div><div><div><br></div><div>something like this</div><div><br></div><div> while tru:</div><div> try:</div><div> conn_broker = pika.BlockingConnection(conn_params)</div>
<div> channel = conn_broker.channel()</div><div> channel.exchange_declare( exchang</div></div><div> .....</div><div><div> except Exception, e:</div><div> traceback.print_exc()</div></div><div>
<br></div><div>Now, in parallel I understand another goal should be to hold one connection to the server and multiple channels per thread and client. </div><div><br></div><div>Questions :</div><div>When exception occurs, will I need to check if connection is still open and close it?</div>
<div>What if other consumer who uses it is alive and receiving? wouldn't it kill it too? </div><div>Is it recomendded to open multiple connections?</div><div><br></div><div> </div><div>Is there somewhere another design for this situation?<br>
</div><div>Thanks.</div></div>