[rabbitmq-discuss] Durable subscriptions in Java

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


Hi, 
I'd like to create a durable subscription as known from JMS
(http://docs.oracle.com/cd/E19798-01/821-1841/bncgd/index.html)

I have followed the article:
http://rabbitmq.1065348.n5.nabble.com/One-producer-multiple-subscribers-td8705.html

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
anything.

I have read something about durable subscriptions in STOMP plugin, but this
seems to be very low-level for java solution:
http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-October/023164.html

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