[rabbitmq-discuss] immediate, mandatory flag with no consumers
cogitate
monish.unni at gmail.com
Wed Apr 25 20:27:41 BST 2012
i am trying to understand the usage of "immediate" and "mandatory" vis-
a-vis when there are no consumers, to get rabbitmq broker to call
handleReturn callback, after i setup returnListener.
i ran through the following scenarios:
1. no exchange, no queue
2. exchange, no queue
3. exchange, queue - no consumers
but, i don't get a return call from the server.
following pseudo code/ fragment is what i use:
//setup queue
REPLY_QUEUE = "REPLY_QUEUE;
boolean durable = false;
boolean autoDelete = true;
boolean exclusive = false;
try {
channel.queueDeclare(REPLY_QUEUE,durable,exclusive,autoDelete,null);
} catch (IOException e) {}
//setup consumer:
consumer = new QueueingConsumer(channel);
try {
channel.basicConsume(REPLY_QUEUE,true,consumer);
} catch (IOException e) {}
//setup listener:
channel.addReturnListener(new ReturnListener() {
@Override
public void handleReturn(int replyCode, String replyText,
String exchange, String routingKey, AMQP.BasicProperties properties,
byte[] body) throws IOException {
log("[ERROR:Service :"+routingKey+" seems down,
returning with code="+replyCode+" message="+replyText+"]");
}
});
//publish message:
// using BasicProperties.Builder, i add a replyTo= REPLY_QUEUE
// props represents an instance of AMQP.BasicProperties w/ replyTo set
boolean mandatory=true;
boolean immediate=true;
channel.basicPublish(exchange, routingKey, mandatory,
immediate,props,payload);
......
any help in understanding is much appreciated.
i have gone through these posts :
*
http://groups.google.com/group/rabbitmq-discuss/browse_thread/thread/176fc9b40a8c0b52/b6629b6cd14dec01?lnk=gst&q=immediate#b6629b6cd14dec01
* http://groups.google.com/group/rabbitmq-discuss/browse_thread/thread/5490be59d478f88/52ee9568d07441a6?lnk=gst&q=immediate#52ee9568d07441a6
the second throws some light on use case 2. the first link, is quite
enlightening but, since it was a thread in 2010, wondering if it's
status quo.
thanks and regards,
-cogitate
More information about the rabbitmq-discuss
mailing list