An AWS SQS transport adapter for @node-ts/bus-core.
npm install @node-ts/bus-sqsAn Amazon SQS transport adapter for @node-ts/bus
š„ View our docs at https://bus.node-ts.com š„
š¤ Have a question? Join the Discussion š¤
Install packages and their dependencies
``bash`
npm i @node-ts/bus-sqs @node-ts/bus-core
Once installed, configure Bus to use this transport during initialization:
`typescript
import { Bus } from '@node-ts/bus-core'
import { SqsTransport, SqsTransportConfiguration } from '@node-ts/bus-sqs'
const sqsConfiguration: SqsTransportConfiguration = {
awsRegion: process.env.AWS_REGION,
awsAccountId: process.env.AWS_ACCOUNT_ID,
queueName: my-service,my-service-dead-letter
deadLetterQueueName:
}
const sqsTransport = new SqsTransport(sqsConfiguration)
// Configure Bus to use SQS as a transport
const bus = Bus.configure().withTransport(sqsTransport).build()
await bus.initialize()
`
Local development can be done with the aid of docker to run the required infrastructure. To do so, run:
`bash`
docker run -e SERVICES=sqs,sns -e DEFAULT_REGION=us-east-1 -p 4566-4583:4566-4583 localstack/localstack
This will create a localstack instance running and exposing a mock sqs/sns that's compatible with the AWS-SDK. This same environment is used when running integration tests for the SqsTransport`.