[rabbitmq-discuss] Handle Stale Connections on Clients

cogitate monish.unni at gmail.com
Tue Jul 10 17:47:39 BST 2012


Hi Mathias et al:

Given:
-- java rabbitmq client 2.8.2
-- rabbitmq broker 2.8.2
-- wrote an amqp client library (java) that has the following semantics:
[1] setting up connection properties
 [1.1] username, password (authentication)
 [1.2] host, port ( endpoint )
 [1.3] # of threads(concurrent users), # of connections(conn.), conn.
timeout, receive timeout
 * # of usable clients effectively = threads x connections

[2] A manager sets up a pool for fair-sharing of resources per thread.
 [2.1] sets up a connection pool
 [2.2] sets up request/reply channels
 [2.3] sets up re-usable reply-queues

[3] A client class derived from the manager
 [3.1] this pre-configured (with properties in [2])
 [3.2] specify exchange(context), routing-key(service), payload(a message)
 

when a broker is shutdown and restarted, the stack i get is :
[ERROR:clean connection shutdown; reason: Attempt to use closed channel]
com.rabbitmq.client.AlreadyClosedException: clean connection shutdown;
reason: Attempt to use closed channel
	at com.rabbitmq.client.impl.AMQChannel.ensureIsOpen(AMQChannel.java:190)
	at com.rabbitmq.client.impl.AMQChannel.rpc(AMQChannel.java:223)
	at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:209)
	at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:118)
	at
com.rabbitmq.client.impl.ChannelN.exchangeDeclarePassive(ChannelN.java:660)
	at
com.rabbitmq.client.impl.ChannelN.exchangeDeclarePassive(ChannelN.java:61)
	at com.xx.s2.amqp.AmqpClient.doSend(AmqpClient.java:187)
	at com.xx.s2.amqp.AmqpClient.callService(AmqpClient.java:80)
	at
com.xx.s2.amqp.StaleConnectionTest.callLoopTest(StaleConnectionTest.java:132)
	at com.xx.s2.amqp.StaleConnectionTest.loopTest(StaleConnectionTest.java:86)

at this point, i have to shutdown the client using the library and restart
it. is there a way to handle this exception and re-establish the connection?
any utilities that will allow me to do this "automatically"?

thanks and regards,
-monish

--
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Handle-Stale-Connections-on-Clients-tp20687.html
Sent from the RabbitMQ mailing list archive at Nabble.com.


More information about the rabbitmq-discuss mailing list