<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; ">
<div>Hi,</div>
<div><br>
</div>
<div>I tried this, with a slight modification:</div>
<div><br>
</div>
<div>Instead of having a dedicated second exchange, I use the default exchange and set the routing key to the name of the queue I want it routed to.</div>
<div><br>
</div>
<div>
<div style="font-family: Calibri; font-size: medium; ">Queue A, no TTL, x-dead-letter-exchange='', x-dead-letter-routing-key='B'</div>
<div style="font-family: Calibri; font-size: medium; ">Queue B, ttl of (x) seconds,&nbsp;x-dead-letter-exchange='', x-dead-letter-routing-key='A'</div>
</div>
<div>&nbsp;</div>
<div>Works like a charm.</div>
<div><br>
</div>
<div>However, there's a problem, which I think will prevent us from using this approach:</div>
<div><br>
</div>
<div>The size of the x-death header attached to the message grows linearly with the number of dead lettering events.</div>
<div><br>
</div>
<div>This is bad for performance, and in the worst case could crash rabbitmq with an out of memory error, if for some reason a message gets rejected a high number of times (or indefinitely).</div>
<div><br>
</div>
<div>It would be great if the x-death header could be limited to have only a bounded number entries, say the last 10 events.</div>
<div><br>
</div>
<div>Plus maybe the total number of redirects.</div>
<div><br>
</div>
<div>Cheers,</div>
<div><br>
</div>
<div>Stefan Kaes</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<blockquote id="MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="BORDER-LEFT: #b5c4df 5 solid; PADDING:0 0 0 5; MARGIN:0 0 0 5;">
<div>
<div>
<div dir="ltr">
<div>On Fri, Jul 26, 2013 at 11:18 PM, Matthias Radestock&nbsp;<span dir="ltr">&lt;<a href="mailto:matthias@rabbitmq.com" target="_blank">matthias@rabbitmq.com</a>&gt;</span>&nbsp;wrote:
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Queue A, no TTL, DLX=Exchange B (with Queue B bound to it).<br>
Queue B, ttl of (x) seconds, DLX= Exchange A (with Queue A bound to it).<br>
<br>
When we NAck the mesage from Queue A, we set requeue=false.<br>
</blockquote>
<br>
</div>
Yep, that makes perfect sense and should work well.<font color="#888888"><br>
</font></blockquote>
</div>
<div><br>
</div>
<div><br>
</div>
<div>I'll give the using-deadletter-exchange with NAck approach a go.&nbsp;</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>On Sat, Jul 27, 2013 at 1:49 AM, Tom Anderson&nbsp;<span dir="ltr">&lt;<a href="mailto:tom.anderson@timgroup.com" target="_blank">tom.anderson@timgroup.com</a>&gt;</span>&nbsp;wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="im"><br>
</div>
Implemented exactly as described there, it yields an infinite loop for unprocessable messages. You might therefore also want to keep a count of the number of processing attempts in a header on the message, and more thoroughly reject messages which reach some
 maximum number of attempts. I think you could do the final rejection by setting a routing key on the message when you reject it for the last time, and having exchange B be a direct exchange which routes to either queue B or some final deadletter queue.<br>
</div>
</blockquote>
<div><br>
</div>
<div>&nbsp;</div>
</div>
<div>Yep, we've got other ways to deal with permanent failures/poison messages.&nbsp;</div>
<div>This is purely to deal with transient problems where we might need to try several times.&nbsp;</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks for the feedback and discussion everyone.&nbsp;</div>
<div>Cheers</div>
<div class="gmail_extra"><br>
</div>
</div>
</div>
</div>
</blockquote>
</span>
</body>
</html>