import { SQSClient } from '@aws-sdk/client-sqs';
const dispatch = sqsDispatcher({
queueUrl: 'https://sqs.us-east-1.amazonaws.com/123456789012/economy-events.fifo',
client: new SQSClient({ region: 'us-east-1' }),
});
await dispatch(event); // resolves once SQS accepts the message
Messaging for how dispatchers deliver events.
Builds the Dispatcher that publishes events to SQS as JSON messages, the body encoded by the shared
encodeEvent(event-wire.ts). Delivery is at-least-once either way; what varies is who dedupes. On a FIFO queue (URL ends in.fifo) the event id becomes theMessageDeduplicationId, so a resend inside SQS's dedup window is dropped at the queue, and the event subject becomes theMessageGroupId, so one subject's events deliver in order. On a standard queue those parameters are omitted (SQS rejects them there) and the receiver dedupes by the event id carried in the body.On failure it throws a retryable
PROVIDER.FAILUREso the caller's backoff wrapper retries.