0.1.7 • Published 8 days ago

@driimus/sqs-permanent-failure-dlq v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
8 days ago

@driimus/sqs-permanent-failure-dlq

npm

Non-retryable error handler for @driimus/lambda-batch-processor that sends corresponding SQS messages to a dead-letter SQS queue.

Installation

!WARNING This is an ES only package. Before installing, make sure that your project's configuration supports ECMAScript modules.

pnpm add @driimus/lambda-batch-processor @driimus/sqs-permanent-failure-dlq @aws-sdk/client-sqs

Type hints

For types to work as expected, @types/aws-lambda must be installed:

pnpm add --save-dev @types/aws-lambda

Usage

import { SQSBatchProcessor } from '@driimus/lambda-batch-processor';
import { PermanentFailureDLQHandler } from '@driimus/sqs-permanent-failure-dlq';

const queueUrl = 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue'; // your queue url

const processor = new SQSBatchProcessor(
  async (record) => {
    /** do stuff */
  },
  {
    nonRetryableErrorHandler: new PermanentFailureDLQHandler(queueUrl),
  },
);

export const handler = processor.process;

Custom SQS Client

By default, every instance of the handler will instantiate a new SQS client. It is possible to provide a custom client, which is especially helpful in scenarios where additional instrumentation is required, or you need to reuse the client elsewhere.

import { SQSClient } from '@aws-sdk/client-sqs';
import { PermanentFailureDLQHandler } from '@driimus/sqs-permanent-failure-dlq';

const sqs = new SQSClient({
  /** custom config */
});

const queueUrl = 'https://queue.amazonaws.com/80398EXAMPLE/MyQueue'; // your queue url

const nonRetryableErrorHandler = new PermanentFailureDLQHandler(queueUrl, sqs);
0.1.7

8 days ago

0.1.6

13 days ago

0.1.2

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.5

1 year ago

0.1.1

1 year ago