<div dir="ltr">You can try this:<div><br></div><div>Lets say you can work on 1 minute boundaries - that's what we do.</div><div><br></div><div>When you have a message you want to delay to exchange E, calculate: 1) the datetime DT to the minute at which you want it released; 2) the corresponding number of milliseconds MS from now.</div>
<div><br></div><div>Declare a queue QDT with a name incorporating DT and a dead letter exchange of E. If there is already a queue with that name and exact parameters it's OK - queue declarations are idempotent so you will neither get a redundant queue nor will you get an error if it already exists.</div>
<div><br></div><div>Publish your message to queue QDT with an expiry of MS.</div><div><br></div><div>At DT (or close enough) the message expirations will take effect and the messages will be released in queued order to exchange E.</div>
<div><br></div><div>You can use a policy to delete queue QDT.</div><div><br></div><div>Hope that helps!</div><div><br></div><div>ml</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 21, 2014 at 6:57 AM, Daniel McGreal <span dir="ltr"><<a href="mailto:daniel@redbite.com" target="_blank">daniel@redbite.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Ah, I see the problem in the <a href="http://www.rabbitmq.com/ttl.html#per-message-ttl-caveats" target="_blank">Caveats</a>.<div>
<div class="h5"><div><br><div><div>On 21 Mar 2014, at 10:49, Daniel McGreal wrote:</div><br><blockquote type="cite"><div style="word-wrap:break-word">I'm not familiar with all aspect of the process, but couldn't you set a TTL on the message, not the queue?<div>
<a href="http://www.rabbitmq.com/ttl.html#per-message-ttl" target="_blank">http://www.rabbitmq.com/ttl.html#per-message-ttl</a></div><div><div>With no consumers on this queue it ends up in ultimately it will be dead lettered to an exchange/queue/consumer setup where your actual processing happens, i.e. there was at least the specified delay in processing customisable per message?</div>
<div><br><div><div>On 21 Mar 2014, at 10:22, Ajinkya Apte wrote:</div><br><blockquote type="cite">
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>Thanks for the reply. So the only problem I see with what I want to do and with whats available in RabbitMQ is I will have to time slice and create multiple queues. </div>
<div>For example:</div>
<div>One queue with a timeout of 5 min, the other 10 min. Then according to the delay time just put incoming data into the proper queue.</div>
<div>The down side I can see is that new data that will be thrown in a queue with say a 10 min timeout, will be theoretically processed anywhere between 1-10 mins. I cannot kinda guarantee that the data will be handled only after 10 mins.</div>
<div><br>
</div>
<div>Does this make sense to you?</div>
<div><br>
</div>
<div>Do you create a new queue per request coming in, depending on a the delay?</div>
<div><br>
</div>
<div>AJ</div>
<div><br>
</div>
<span>
<div style="border-right:medium none;padding-right:0in;padding-left:0in;padding-top:3pt;text-align:left;font-size:11pt;border-bottom:medium none;font-family:Calibri;border-top:#b5c4df 1pt solid;padding-bottom:0in;border-left:medium none">
<span style="font-weight:bold">From: </span><Laing>, Michael <<a href="mailto:michael.laing@nytimes.com" target="_blank">michael.laing@nytimes.com</a>><br>
<span style="font-weight:bold">Reply-To: </span>Discussions about RabbitMQ <<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, March 20, 2014 6:36 PM<br>
<span style="font-weight:bold">To: </span>Discussions about RabbitMQ <<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a>><br>
<span style="font-weight:bold">Subject: </span>Re: [rabbitmq-discuss] : Delayed processing of data<br>
</div>
<div><br>
</div>
<div>
<div>
<div dir="ltr">We currently use TTLs and Dead Letter Exchanges to accomplish this.
<div><br>
</div>
<div>An app we call Route looks at messages and either:</div>
<div>
<ol>
<li>sends them to an exchange called Distribute, or </li><li>declares a queue with a name reflecting the embargo datetime and a DLX of Distribute and sends the message to it with a TTL calculated to release at that datetime.<br>
</li></ol>
<div>This works fine. You can dynamically set a policy to delete the queue.</div>
</div>
<div><br>
</div>
<div>Probably we will move away from this in the next few months simply because we wish to persist as little as possible in rabbitmq. But it is quite simple and functional.</div>
<div><br>
</div>
<div>ml</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Thu, Mar 20, 2014 at 2:11 PM, Ajinkya Apte <span dir="ltr">
<<a href="mailto:aapte@zynga.com" target="_blank">aapte@zynga.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" type="cite">
<div style="font-size:14px;font-family:Calibri,sans-serif;word-wrap:break-word">
<div>Hey guys,</div>
<div>I want to delay the processing of some data coming into a queue. The data has delayTime associated with it.</div>
<div><br>
</div>
<div>What I want to do?</div>
<ol>
<li>Data is coming in with a delayTime associated with it. </li><li>Some data can come with the delayTime=5 mintes from now, some data with delayTime=10 and so on. This delayTime can be anything.</li><li>I want to delay the processing of this data. </li>
</ol>
<div><br>
</div>
<div>Questions?</div>
<ol>
<li>From the documentation seems like using message TTL won't be the way to go, right? </li><li>Will I have to use the 'Dead Letter Exchanges' concept along with multiple retry queues having different timeouts?
</li><li>Any other suggestions?</li></ol>
<div><br>
</div>
<div>Please let me know.</div>
<div>Thanks,</div>
<div><br>
</div>
<div>AJ</div>
</div>
<br>
_______________________________________________<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="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</span>
</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="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div></div></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="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br></blockquote></div><br></div></div></div></div><br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></blockquote></div><br></div>