[rabbitmq-discuss] Handle Stale Connections on Clients
grussell at vmware.com
Wed Jul 11 19:53:30 BST 2012
It shouldn't take much heavy lifting to use spring-amqp instead of the raw apis, and it will take care of reconnecting, setting up queues etc, via the ConnectionListener callback in the RabbitAdmin class.
On the receiving side, you don't have to write any special listeners etc to use spring-amqp; you can just write your code as a POJO and the container uses an adapter to call your code. On the outbound side just use a RabbitTemplate; in most cases you can use high-level APIs, while still having access to the low level APIs (channel) if you ever need them.
If you can't move to spring-amqp, you might be able to leverage some of the code from RabbitAdmin.
On 07/11/2012 02:16 PM, cogitate wrote:
Jerry Kuch-2 wrote
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.
thanks much Jerry for such a prompt reply. I would love to re-use
spring-amqp and use the wrapped connection( it seems CachedConnectionFactory
+ SimpleListenerContainer ).
what i am wondering for a simple amqp client that simply wants to re-connect
when a broker shutsdown, is there any way i can re-initialize all my
reply-queues( i have uuids associated with them), channels (wrapped channel
objects associated with connections) without having to re-write the code
sorry to be presume that you would know the answer to this.....but a simple
logic/example would be great of how to go about it.
the spring-amqp project seems to be quite complicated as it seems to have
logic for transactions ( also it's not entirely clear to me if i need to
write a listener container or just register a shutdownlistener etc).
thanks and regards,
View this message in context: http://rabbitmq.1065348.n5.nabble.com/Handle-Stale-Connections-on-Clients-tp20687p20721.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com<mailto:rabbitmq-discuss at lists.rabbitmq.com>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss