title: SQS Lambda - retry logic?
body: <p>When the message has been added to an SQS queue and it is configured to trigger a lambda function (nodejs). </p>
  
  <p>When a lambda function is triggered - I may want to retry same message again after 5 minute without deleting the message from the Queue. The reason I want to do this if Lambda could not connect external host (eg: API) - i like to try again after 5 minutes for 3 attempts only. </p>
  
  <p>How can that be written in node js?</p>
  
  <p>For example in Laravel, we can <code>Specifying Max Job Attempts</code> functionality. The number of times the job may be attempted using <code>public $tries = 5;</code> </p>
  
  <p>Source: <a href="https://laravel.com/docs/5.7/queues#max-job-attempts-and-timeout" rel="noreferrer">https://laravel.com/docs/5.7/queues#max-job-attempts-and-timeout</a></p>
  
  <p>How can we do similar fashion in node.js?</p>
  
  <p>I am thinking adding a message to another queue (for retry). A lambda function read all the messages from that queue after 5 minutes and send that message back to main Queue and it will be trigger a lambda function.</p>