So what is going on in my test case?<div><br></div><div>I restart rabbitmq and I suddenly have a bunch of old messages in the queue. Surely that's not expected</div><div><br></div><div>--</div><div>Robert Borkowski<br>
<br><div class="gmail_quote">On Mon, Dec 14, 2009 at 6:29 PM, Matthias Radestock <span dir="ltr"><<a href="mailto:matthias@lshift.net">matthias@lshift.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Robert Borkowski wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Agreed, and that's why I'm testing failure scenarios.<br>
<br>
It would be nice to not to have to re-invent the wheel :-)<br>
<br>
Isn't this a somewhat common use-case? A work queue filled with<br>
tasks that can only be run once, running on real hardware which<br>
means that at some point parts of the system WILL fail.<br>
</blockquote>
<br></div>
"at-least once" and "at-most once" execution are quite easy to do. "exactly once" is generally impossible. In case that is not obvious, think about what precisely it is that you want to happen exactly once. Then try to figure out how you'd perform that action *and record the fact that it has happened* in one atomic action.<br>
<br>
By far the easiest way to get around that is to make the desired action idempotent. Then it is sufficient to guarantee "at-least once" execution, which is easy to do in AMQP by ack'ing messages after the actions that they trigger have been completed.<br>
<br>
<br>
Regards,<br><font color="#888888">
<br>
Matthias.<br>
</font></blockquote></div><br><br>
</div>