[rabbitmq-discuss] When I switch my network connection from one wifi router to another, two consumers are created

Emile Joubert emile at rabbitmq.com
Thu Oct 31 09:36:40 GMT 2013


Hi,

On 31/10/13 07:46, Liong Hung Wong wrote:

> When I switch my network connection from one wifi router to another, two
> consumers are created for the queue as below. In that case, messages
> will be distributed between both consumers, hence, the app only receives
> alternate message until the first connection timeout due to heartbeat
> setting.

If you want to ensure that only one consumer can get messages from a
queue then set the exclusive flag.

> I am not able to cancel the first consumer with
> channel.basicCancel(consumerTag) when as the connection has already been
> closed. Is there any way to overcome this problem?

This should not be a problem. If the connection of one consumer has
already closed by the time the second consumer opened then there will be
no overlap in subscriptions. If consumers subscribe without autoAck then
unacknowledged messages will be returned to the queue when a connection
terminates, and any subsequent consumer will be able to process such
messages.



-Emile






More information about the rabbitmq-discuss mailing list