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