[rabbitmq-discuss] Publish-Confirm
cw storm
cwstorm at gmail.com
Wed Feb 26 18:16:45 GMT 2014
I would like to use the example code provided in
http://www.rabbitmq.com/blog/2011/02/10/introducing-publisher-confirms/
I'm trying to understand the below snippet:
for (long i = 0; i < MSG_COUNT; ++i) {
unconfirmedSet.add(ch.getNextPublishSeqNo());
ch.basicPublish("", QUEUE_NAME, MessageProperties.PERSISTENT_BASIC,
"nop".getBytes());
}
while (unconfirmedSet.size() > 0)
Thread.sleep(10);
As stated, "the producer waits for all the messages to be confirmed."
Assuming that's the above code. Is the "while" logic safe? What
happens when the "unconfirmedSet.size" is always greater than 0?
Also, the "MSG_COUNT" if set to 10000, does the for loop will always
loop 10000 times even though there might only be say 10 messages?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140226/b3764644/attachment.html>
More information about the rabbitmq-discuss
mailing list