[rabbitmq-discuss] Durable subscriptions in Java
Michael Klishin
mklishin at gopivotal.com
Fri Feb 7 08:53:35 GMT 2014
On 7 Feb 2014, at 12:26, Tomas Tulka <tomas.tulka at atos.net> wrote:
> // run comsumers
> QueueingConsumer consumerA = new QueueingConsumer(channel);
> channel.basicConsume(queueNameA, true, consumerA);
> QueueingConsumer consumerB = new QueueingConsumer(channel);
> channel.basicConsume(queueNameB, true, consumerB);
>
> Producer produces for a while and stop meanwhile consumers consume and then
> consumers died. Afterwards consumers are re-created but don't consume
> anything.
If the queue still has messages when a consumer is added, it should get deliveries.
if the queue is durable and messages are published as persistent, this should hold true
for broker restarts.
Use management UI to find our if there are any messages. Also, you consume
with automatic acknowledgement mode. This means that RabbitMQ will remove messages
as soon as it sends them out to consumers. If by the time consumer recovers there is no
incoming message flow to the queue, there will be nothing for RabbitMQ to deliver.
MK
Software Engineer, Pivotal/RabbitMQ
More information about the rabbitmq-discuss
mailing list