[rabbitmq-discuss] Durable subscriptions in Java

Tomas Tulka tomas.tulka at atos.net
Fri Feb 7 08:26:06 GMT 2014

I'd like to create a durable subscription as known from JMS

I have followed the article:

and create this code:

channel.exchangeDeclare(exchangeName, "fanout", durable, false, null); // I
tried with "topic" as well
// for the customerA
channel.queueDeclare(queueNameA, durable, false, false, null);
channel.queueBind(queueNameA, exchangeName, "#");	
// for the customerB
channel.queueDeclare(queueNameB, durable, false, false, null);
channel.queueBind(queueNameB, exchangeName, "#");

// in parallel:

// produce for a while
channel.basicPublish(exchangeName, "test", null, message);

// 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

I have read something about durable subscriptions in STOMP plugin, but this
seems to be very low-level for java solution:

Thank you in advance!

View this message in context: http://rabbitmq.1065348.n5.nabble.com/Durable-subscriptions-in-Java-tp33183.html
Sent from the RabbitMQ mailing list archive at Nabble.com.

More information about the rabbitmq-discuss mailing list