An SQS redrive policy can be used to move messages that cannot be processed to a dead letter queue. Throwing an error (or returning a rejected promise) from the handler function will cause the message to be left in the queue.if using handleMessageBatch, messages processed successfully should be deleted manually and throw an error to send the rest of the messages back to the queue.Messages are deleted from the queue once the handler function has been completed successfully.The queue is polled continuously for messages using long polling.Run the code node consumer.js to start polling the queue for messages We will be using default settings.Ĭonst sqs = new AWS.SQS( = require(‘sqs-consumer’) Ĭonsole.log(‘Consumer service is running’) Click on “Create Queue” at the bottom of the page.Click “Create queue” under the heading Get started.On AWS Management Console search and select Simple Queue Service.Get your access key ID and secret access key.Create a Consumer(consumer.js) to consume messages from the queue.Create a Producer(producer.js) to send messages to the queue.For example, you want to prevent customers from being debited twice after an order is placed. On the other hand, you should use FIFO queues if your application can not tolerate duplicates and out-of-order delivery. For example, you want to resize images after upload. You should use standard queues as long as your application can process messages that arrive out of order and once. First-In-First-Out Delivery:The order in which messages are sent and received is strictly preserved (i.e.Duplicates aren’t introduced into the queue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |