<div dir="ltr">William;<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Nov 14, 2013 at 12:14 PM, William Weens <span dir="ltr"><<a href="mailto:william.weens@gmail.com" target="_blank">william.weens@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>Suppose you start to consume (amqp_basic_consume) and loop over the frames when a exception is thrown and you exit the loop.</div><div><br></div><div>Remaining messages in the queue are consumed but not examined anymore :</div>
<div><br></div><div>- is there a way to find these "lost" messages ?</div></div></blockquote><div><br></div><div>Yes. Any messages that are delivered, but not acked by the client will be redelivered by the broker in the event an exception is returned to the client. (assuming you didn't specify no_ack when setting up your consumer). Depending on the type of exception (channel or connection) you will need to open a new channel, and create a new consumer to get these messages redelivered.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Won't it be safer to get one, handle it, catch exceptions if any and then move to the other one ?<br>
</div></div></blockquote><div><br></div><div>You should handle exceptions as they're received by the client. Attempting to use a channel after it has thrown an exception will result in a connection exception being thrown (which means you'd need to close and re-open the entire connection).</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>- if yes, does "get" method consume the message as well ?</div></div></blockquote>
<div>Get synchronously polls the broker for new messages. It does have the same effect of removing a message from the front of the queue in question on the broker. </div><div><br></div><div>-Alan</div></div></div></div>