title: RabbitMQ - Scheduled Queue - Dead Letter Queue - Good practise
body: <p>we have setup some workflow environment with Rabbit.</p>
  
  <p>It solves our needs but I like to know if it is also good practise to do it like we do for scheduled tasks.</p>
  
  <p>Scheduling means no mission critical 100% adjusted time. So if a job should be retried after 60 seconds, it does mean 60+ seconds, depends on when the queue is handled.</p>
  
  <p>I have created one Q_WAIT and made some headers to transport settings.</p>
  
  <p>Lets do it like:</p>
  
  <p>Worker is running subscribed on Q_ACTION</p>
  
  <p>If the action missed (e.g. smtp server not reachable)</p>
  
  <p>-> (Re-)Publish the message to Q_WAIT and set properties.headers["scheduled"] = time + 60seconds</p>
  
  <hr>
  
  <p>Another process <strong>loops</strong> every 15 seconds through all messages in Q_WAIT by method pop() and NOT by subscribed</p>
  
  <pre><code>q_WAIT.pop(:ack =&gt; true) do |delivery_info,properties,body|...
  
    if (properties.headers["scheduled"] has reached its time)
  
       -&gt; (Re-)Publish the message back to Q_ACTION
          ack(message)
  </code></pre>
  
  <hr>
  
  <p>after each loop, the connection is closed so that the NOT (Re-)Published are left in Q_WAIT because they were not acknowledged.</p>
  
  <hr>
  
  <p>Can someone confirm this as a working (good) practise.</p>