Hi, Monish:<br><br>If you're using the naked Java client, you'll have to implement your own reconnection logic. If you're using Spring AMQP there's some helper code that wraps your connections with some retry logic for you.<br>
<br>Best regards,<br>Jerry<br><br><div class="gmail_quote">On Tue, Jul 10, 2012 at 9:47 AM, cogitate <span dir="ltr"><<a href="mailto:monish.unni@gmail.com" target="_blank">monish.unni@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Mathias et al:<br>
<br>
Given:<br>
-- java rabbitmq client 2.8.2<br>
-- rabbitmq broker 2.8.2<br>
-- wrote an amqp client library (java) that has the following semantics:<br>
[1] setting up connection properties<br>
[1.1] username, password (authentication)<br>
[1.2] host, port ( endpoint )<br>
[1.3] # of threads(concurrent users), # of connections(conn.), conn.<br>
timeout, receive timeout<br>
* # of usable clients effectively = threads x connections<br>
<br>
[2] A manager sets up a pool for fair-sharing of resources per thread.<br>
[2.1] sets up a connection pool<br>
[2.2] sets up request/reply channels<br>
[2.3] sets up re-usable reply-queues<br>
<br>
[3] A client class derived from the manager<br>
[3.1] this pre-configured (with properties in [2])<br>
[3.2] specify exchange(context), routing-key(service), payload(a message)<br>
<br>
<br>
when a broker is shutdown and restarted, the stack i get is :<br>
[ERROR:clean connection shutdown; reason: Attempt to use closed channel]<br>
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown;<br>
reason: Attempt to use closed channel<br>
at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:190)<br>
at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:223)<br>
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:209)<br>
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)<br>
at<br>
com.rabbitmq.client.impl.ChannelN.exchangeDeclarePassive(ChannelN.java:660)<br>
at<br>
com.rabbitmq.client.impl.ChannelN.exchangeDeclarePassive(ChannelN.java:61)<br>
at com.xx.s2.amqp.AmqpClient.doSend(AmqpClient.java:187)<br>
at com.xx.s2.amqp.AmqpClient.callService(AmqpClient.java:80)<br>
at<br>
com.xx.s2.amqp.StaleConnectionTest.callLoopTest(StaleConnectionTest.java:132)<br>
at com.xx.s2.amqp.StaleConnectionTest.loopTest(StaleConnectionTest.java:86)<br>
<br>
at this point, i have to shutdown the client using the library and restart<br>
it. is there a way to handle this exception and re-establish the connection?<br>
any utilities that will allow me to do this "automatically"?<br>
<br>
thanks and regards,<br>
-monish<br>
<br>
--<br>
View this message in context: <a href="http://rabbitmq.1065348.n5.nabble.com/Handle-Stale-Connections-on-Clients-tp20687.html" target="_blank">http://rabbitmq.1065348.n5.nabble.com/Handle-Stale-Connections-on-Clients-tp20687.html</a><br>
Sent from the RabbitMQ mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br>