Hello,<div>I am trying to understand the effect ConfirmationListeners have on channel closing. It looks like if messages are published with "mandatory=true", the corresponding Channel.close will block until all notifications have been received (unsure of any timeout, I've seen it block for over a minute). I understand "mandatory" to mean "return the message to all Return/Confirm listeners". Is this blocking behavior also part of mandatory behavior, or should close() happen immediately?</div>
<div><br></div><div>Something else interesting happens when you close a channel with pending callbacks: listeners are immediately removed. The consequence is you block until all confirmations/returns have happened, but your listeners don't receive them. </div>
<div><br></div><div>Here's some example code:</div><div><a href="https://gist.github.com/1665378">https://gist.github.com/1665378</a></div><div><br></div><div>If you call this with </div><div><div>RabbitTest.publish(0, exchange, routingKey, msg, brokerAddress);</div>
<div>prints "0 callbacks, waited 0ms before close, close took 5959"</div><div><br></div><div>RabbitTest.publish(5000, exchange, routingKey, msg, brokerAddress);</div></div><div>prints "427 callbacks, waited 5000ms before close, close took 833"</div>
<div><br></div><div>Note how both take roughly 5800ms. On the first call, we don't pause before calling close, and receive 0 callbacks. However, the second one, which waits 5000ms before trying to call close, gets most of the callbacks. A longer pause before close results in all callbacks being handled.</div>
<div><br></div><div>To reproduce this, I use a roughly 200 character string as my message. It's also important that the message be published as "persistent" - I think transient messages are too fast to reveal this :)</div>
<div><br></div><div>Should callbacks block close? If so, should listeners continue to receive callbacks as close happens?</div><div><br></div><div>Thank you,</div><div>Adam</div>