I have written a stripped down example where the producer puts a message in a queue and then quits. The consumer works with automatic or explicit acknowledgment accordingly to an input value is provided to it. Looking at the code, we can see how the changes are very localized. We specify that the QueueingConsumer for the channel/queue is in one mode or the other, and then, if an explicit ack is required, we give it when the job is done:
// ... QueueingConsumer consumer = new QueueingConsumer(channel); channel.basicConsume(QUEUE_NAME, autoAck, consumer); // 1 QueueingConsumer.Delivery delivery = consumer.nextDelivery(); // ... if(!autoAck) { // 2 channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false); // ... }1. Here we specify if an handshake is required (autoAck sets to false) or if we rely on the standard auto-acknowledging RabbitMQ policy.
2. When we are done with the message, and if we are not in auto-acknowledgment mode, we give our explicit acknowledgment to the rabbit broker.
The complete Java code is on github.
hi can u explain rabbitmq time to live (ttl) java client examples
ReplyDeleteHello, sure.
DeleteHave a look at this post bitingcode.blogspot.com/2012/06/per-queue-message-time-to-live-ttl.html
hi Manny
Deletehow much data can publisher send at a time to queue? can publisher send 1GB data to queue. is any limits is their?
Sorry Vadiraj, I don't know. I guess it is a platform-dependent limit, maybe there is some configuration parameter to set.
DeleteIf I were you, I would post a question on stackoverflow.com
This comment has been removed by the author.
DeleteCan't help you on this either. I have only used rabbitmq for Java.
DeleteThis comment has been removed by the author.
DeleteI'd suggest you to write some very simple test cases. When you get stuck on a very definite issue, you could raise a clear question on that point (on stack overflow, possibly).
DeleteThis comment has been removed by the author.
DeleteHi Manny
DeleteIs it posible to know what time message is arrived in queue? if yes how to know that?
how to remove Duplicate Messages received by consumer(java client)? please explain with example.
ReplyDelete