Amazon SQS

SQS is a fully managed queue provider from AWS that's officially supported by @node-ts/bus. Once configured, @node-ts/bus will automatically create all SNS topics, SQS queues and manage subscriptions for the handlers of your application.

Installation

Install the @node-ts/bus-sqs package

npm install @node-ts/bus-sqs

Configure the transport and provide this to the bus configuration

import { Bus } from '@node-ts/bus-core'
import { SqsTransport, SqsTransportConfiguration } from '@node-ts/bus-sqs'

const sqsConfiguration: SqsTransportConfiguration = {
  awsRegion: AWS_REGION,
  awsAccountId: AWS_ACCOUNT_ID,
  queueName: 'service-queue',
  deadLetterQueueName: `service-queue-dead-letter`
}
const sqsTransport = new SqsTransport(sqsConfiguration)
await Bus
  .configure()
  .withTransport(sqsTransport)
  .initialize()

Last updated