resending this to the list :)<br><br><div class="gmail_quote">On Tue, May 18, 2010 at 7:59 PM, vishnu <span dir="ltr">&lt;<a href="mailto:pathsny@gmail.com">pathsny@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>well actually we&#39;re doing<br></div><div>basic.consume</div><div><br></div><div>some stuff</div><div>tx.select</div><div>basic.publish</div><div>tx.commit</div><div><br></div><div>some stuff</div><div>basic.ack</div>

<div><br></div><div>currently, we&#39;re �trying to make sure the publish is inside a transaction.�</div><div><div class="h5"><br><div class="gmail_quote">On Tue, May 18, 2010 at 4:34 PM, Michael Bridgen <span dir="ltr">&lt;<a href="mailto:mikeb@rabbitmq.com" target="_blank">mikeb@rabbitmq.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>vishnu wrote:<br>
&gt; we have scenarios where we pick up a message at a time, perform a bunch<br>
&gt; of operations, publish a new message and then ack the message we just<br>
&gt; picked up. Recently we have started to publish the new message inside a<br>
&gt; transaction since this guarantees that the message is persisted (it&#39;s a<br>
&gt; persistent message), since we want to minimize the odds of message loss.<br>
&gt; However, we have started to notice that the original message we pick up<br>
&gt; is marked as unacknowledged after we complete our process. Is there<br>
&gt; something fundamentally wrong in what we&#39;re doing, or is our approach<br>
&gt; correct?<br>
<br>
</div></div><div>The approach is correct. �What order are you doing things in?<br>
Transactions are implicitly started immediately after a commit or<br>
rollback, and acknowledgements are transactional, so if you&#39;re<br>
committing after the publish but before the ack --<br>
<br>
basic.publish(new_message)<br>
tx.commit()<br>
basic.ack(old_message)<br>
<br>
the state at this point is a published message, and an uncommitted<br>
transaction with the ack. �If you do this:<br>
<br>
basic.publish(new_message)<br>
basic.ack(old_message)<br>
tx.commit()<br>
<br>
then you&#39;ll have atomically acked the old message and published the new<br>
one; which is, I believe, what you want.<br>
<br>
<br>
Michael.<br>
<br>
<br>
</div>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br>
</div></div></blockquote></div><br>