resending this to the list :)<br><br><div class="gmail_quote">On Tue, May 18, 2010 at 7:59 PM, vishnu <span dir="ltr"><<a href="mailto:pathsny@gmail.com">pathsny@gmail.com</a>></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'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'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"><<a href="mailto:mikeb@rabbitmq.com" target="_blank">mikeb@rabbitmq.com</a>></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>
> we have scenarios where we pick up a message at a time, perform a bunch<br>
> of operations, publish a new message and then ack the message we just<br>
> picked up. Recently we have started to publish the new message inside a<br>
> transaction since this guarantees that the message is persisted (it's a<br>
> persistent message), since we want to minimize the odds of message loss.<br>
> However, we have started to notice that the original message we pick up<br>
> is marked as unacknowledged after we complete our process. Is there<br>
> something fundamentally wrong in what we're doing, or is our approach<br>
> 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'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'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>