bbc/sqs-consumer — a backend project — sits at 1.9k GitHub stars in the Backend space. Build Amazon Simple Queue Service (SQS) based applications without the boilerplate
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Build SQS-based applications without the boilerplate. Just define an async function that handles the SQS message processing.
Installation
To install this package, simply enter the following command into your terminal (or the variant of whatever package manager you are using):
npm install sqs-consumer
If you would like to use JSR instead, you can find the package here.
Node version
We will only support Node versions that are actively or security supported by the Node team. You can find the list of versions that are actively supported here.
Documentation
Visit https://bbc.github.io/sqs-consumer/ for the full API documentation.
Usage
import { Consumer } from "sqs-consumer";
const app = Consumer.create({
queueUrl: "https://sqs.eu-west-1.amazonaws.com/account-id/queue-name",
handleMessage: async (message) => {
// do some work with `message`
},
});
app.on("error", (err) => {
console.error(err.message);
});
app.on("processing_error", (err) => {
console.error(err.message);
});
app.start();
Polling Behavior: The queue is polled continuously for messages using long polling.
Message Processing Behavior: By default messages are processed one at a time – a new message won't be received until the first one has been processed. To process messages in parallel, use the batchSize option detailed here.
It's also important to await any processing that you are doing to ensure that messages are processed one at a time.
Message Acknowledgment Behavior:
When alwaysAcknowledge is false (the default)
Returning undefined, an empty object {}, or an empty array []: Message(s) will NOT be deleted (left on queue for retry)
For batch processing, return undefined or [] to prevent acknowledgment of all messages.
For single message handling, return undefined or {} to prevent acknowledgment.
Returning the message object (or an array of messages in batch processing): Message(s) will be acknowledged and deleted
Important: Only the message id(s) that are returned will be deleted.
Returning void is discouraged and will be deprecated in a future release.
When strictReturn is true: Returning null will throw an error. This will be the default behavior in a future release.
When alwaysAcknowledge is true: All messages will be acknowledged and deleted regardless of return value.
Error Handling: Throwing an error (or returning a rejected promise) from the handler function will cause the message to be left on the queue. An SQS redrive policy can be used to move messages that cannot be processed to a dead letter queue.
Deletion Process Messages are deleted from the queue once the handler function has completed successfully (the above items should also be taken into account).
FIFO Queue Support
When using SQS Consumer with FIFO (First-In-First-Out) queues, you might see a warning message in your logs.
As mentioned in the warning, we do not explicitly test SQS Consumer with FIFO queues, this means that we cannot guarantee that the library will work as expected, however, with the correct configuration, it should. If you have done that and believe FIFO to be working as expected, you can suppress the warning by setting suppressFifoWarning: true.
To note: In order to maintain FIFO ordering, you should always use the handleMessageBatch method instead of handleMessage.
Credentials
By default the consumer will look for AWS credentials in the places specified by the AWS SDK. The simplest option is to export your credentials as environment variables:
Consumer will receive and delete messages from the SQS queue. Ensure sqs:ReceiveMessage, sqs:DeleteMessage, sqs:DeleteMessageBatch, sqs:ChangeMessageVisibility and sqs:ChangeMessageVisibilityBatch access is granted on the queue being consumed.
API
Consumer.create(options)
Creates a new SQS consumer using the defined options.
consumer.start()
Start polling the queue for messages.
consumer.stop(options)
Stop polling the queue for messages. You can find the options definition here.
By default, the value of abort is set to false which means pre existing requests to AWS SQS will still be made until they have concluded. If you would like to abort these requests instead, pass the abort value as true, like so:
consumer.stop({ abort: true })
Graceful shutdowns
Calling consumer.stop() on its own only prevents new polls from being scheduled. The consumer will emit stopped immediately, even if the current long poll or message handler is still running. To wait for the final poll plus any in-flight message processing to finish, set pollingCompleteWaitTimeMs to the maximum amount of time you are willing to wait.
While waiting, the consumer emits waiting_for_polling_to_complete every second.
If the timeout elapses first, waiting_for_polling_to_complete_timeout_exceeded fires right before stopped.
For graceful shutdowns keep abort: false (the default). Passing abort: true cancels the shared AbortController, which halts heartbeat extensions and prevents acknowledgements/deletions from finishing.
Here's an example of a graceful shutdown implementation:
The most recent commit recorded on bbc/sqs-consumer was 3 months ago, based on the GitHub push timestamp. The repository has 335 forks — one of the better signals of community interest.
How does bbc/sqs-consumer compare to other Backend projects?
bbc/sqs-consumer is tracked by TopGit in the Backend category, with 1.9k GitHub stars and written in TypeScript. Browse the Backend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does bbc/sqs-consumer have?
bbc/sqs-consumer has 1.9k GitHub stars — refresh the page for the live number, or check github.com/bbc/sqs-consumer. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is bbc/sqs-consumer open source?
TopGit's metadata for bbc/sqs-consumer does not record a license. Most public repositories on GitHub ARE open source, but the exact terms vary — verify by opening the LICENSE file directly.
What is bbc/sqs-consumer?
bbc/sqs-consumer (bbc/sqs-consumer) is a TypeScript project on GitHub. From the project's own README: Build Amazon Simple Queue Service (SQS) based applications without the boilerplate
Where do I read more about bbc/sqs-consumer?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/bbc/sqs-consumer is the definitive source.
Read full README in the tab above.
Want a second opinion on sqs-consumer?
Ask an AI that can read this page — one click and you get its take on sqs-consumer.