API reference / @node-ts/bus-sqs / SqsTransport
Class: SqsTransport
Defined in: packages/bus-sqs/src/sqs-transport.ts:86
A transport adapter interface that enables the service bus to use a messaging technology.
Implements
Constructors
Constructor
new SqsTransport(
sqsConfiguration,
sqs?,
sns?
): SqsTransport;Defined in: packages/bus-sqs/src/sqs-transport.ts:113
An AWS SQS Transport adapter for @node-ts/bus
Parameters
| Parameter | Type | Description |
|---|---|---|
sqsConfiguration | SqsTransportConfiguration | Settings to use when resolving queues and topics |
sqs? | SQSClient | A preconfigured SQS service to use instead of the default |
sns? | SNSClient | A preconfigured SNS service to use instead of the default |
Returns
SqsTransport
Properties
| Property | Type | Defined in |
|---|---|---|
deadLetterQueueUrl | string | packages/bus-sqs/src/sqs-transport.ts:98 |
queueUrl | string | packages/bus-sqs/src/sqs-transport.ts:95 |
Methods
deleteMessage()
deleteMessage(message): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:247
Removes a message from the underlying transport. This will be called once a message has been successfully handled by any of the message handling functions.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | TransportMessage<SqsMessage> | The message to be removed from the transport |
Returns
Promise<void>
Implementation of
fail()
fail(transportMessage): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:144
Forwards
Parameters
| Parameter | Type | Description |
|---|---|---|
transportMessage | TransportMessage<SqsMessage> | to the dead letter queue. The message must have been read in from the queue and have a receipt handle. |
Returns
Promise<void>
Implementation of
initialize()
initialize(handlerRegistry): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:255
An optional function that will be called when the service bus is starting. This is an opportunity for the transport to see what messages need to be handled so that subscriptions to the topics can be created.
Parameters
| Parameter | Type | Description |
|---|---|---|
handlerRegistry | TransportInitializationOptions | The list of messages being handled by the bus that the transport needs to subscribe to. |
Returns
Promise<void>
Implementation of
prepare()
prepare(coreDependencies): void;Defined in: packages/bus-sqs/src/sqs-transport.ts:123
An optional function that is called before startup that will provide core dependencies to the transport. This can be used to fetch loggers, registries etc that are used in initialization steps
Parameters
| Parameter | Type |
|---|---|
coreDependencies | CoreDependencies |
Returns
void
Implementation of
publish()
publish<EventType>(event, messageAttributes?): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:130
Publishes an event to the underlying transport. This is generally done to a topic or some other mechanism that consumers can subscribe themselves to
Type Parameters
| Type Parameter |
|---|
EventType extends Event |
Parameters
| Parameter | Type | Description |
|---|---|---|
event | EventType | A domain event to be published |
messageAttributes? | MessageAttributes<MessageAttributeMap, MessageAttributeMap> | Options that control the behaviour around how the message is sent and additional information that travels with it. |
Returns
Promise<void>
Implementation of
readNextMessage()
readNextMessage(): Promise<
| TransportMessage<SqsMessage>
| undefined>;Defined in: packages/bus-sqs/src/sqs-transport.ts:171
Fetch the next message from the underlying queue. If there are no messages, then undefined should be returned.
Returns
Promise< | TransportMessage<SqsMessage> | undefined>
The message construct from the underlying transport, that includes both the raw message envelope plus the contents or body that contains the @node-ts/bus-messages message.
Implementation of
returnMessage()
returnMessage(message): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:251
Returns a message to the queue for retry. This will be called if an error was thrown when trying to process a message.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | TransportMessage<SqsMessage> | The message to be returned to the queue for reprocessing |
Returns
Promise<void>
Implementation of
send()
send<CommandType>(command, messageAttributes?): Promise<void>;Defined in: packages/bus-sqs/src/sqs-transport.ts:137
Sends a command to the underlying transport. This is generally done to a topic or some other mechanism that consumers can subscribe themselves to
Type Parameters
| Type Parameter |
|---|
CommandType extends Command |
Parameters
| Parameter | Type | Description |
|---|---|---|
command | CommandType | A domain command to be sent |
messageAttributes? | MessageAttributes<MessageAttributeMap, MessageAttributeMap> | Options that control the behaviour around how the message is sent and additional information that travels with it. |
Returns
Promise<void>