[rabbitmq-discuss] Network failures recovery with RabbitMQ Javaclient

Busoli, Simone Simone.Busoli at ferrari.com
Fri Dec 9 15:41:41 GMT 2011


> Simone,
> Thank you, this is exactly what I have in mind for publishers. For consumers
> there is a bunch of questions that need to be answered:
> 1. Should recovering apps redeclare AMQP entities they use or use passive
> declares?

Currently I do, yes, although it somewhat defeats the purpose of durable entities which would fit well here. Currently I'm recreating everything from scratch when the connection goes down, and handle recovery of previous data that consumers may need at the application level. I'm however planning to start considering to use durable entities.

> 2. If I have 3 threads each with its own consumer (on separate channels, of
> course), how do I go about reopening their channels after AMQP connection
> is back up?

I'm dealing with this by having a single channel with one consumer which consumes from all the queues the application needs to read data from. What kind of limitation do you see in keeping it single threaded?

> 3. How do I detect that reconnection has succeeded?

In the .NET client when you Open the connection and no exception is thrown I think you can safely assume that the connection has been established.

> So if I understand it correctly, your approach is to have one thread that
> consumes all messages and then dispatches them to different parts of the
> application, is my understanding correct?

Yes, correct. This entails that your application has to cope with messages being consumed by threads that the application does not know directly (as they belong to the messaging library), but I found it to be easier to do that than to consume from rabbit queues from multiple threads with multiple channels. Oh, I didn't specify it explicitly but I also use one single channel for publishing and one single channel for consuming.

> MK
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin

Questo messaggio e da intendersi esclusivamente ad uso del destinatario e puo contenere informazioni che sono di natura privilegiata, confidenziale
o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non e il destinatario designato, o il dipendente/agente responsabile
per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione e 
strettamente proibita anche ai sensi del decreto legislativo 196/03 . Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo
immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.
This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from 
disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the 
message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly 
prohibited. If you have received this e-mail in error, please notify us immediately by return e-mail and delete this e-mail and all attachments from 
your system.

More information about the rabbitmq-discuss mailing list