Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add docs about partial batch responses #76

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,34 @@ processed in parallel.
that do _not_ need to be ordered will not necessarily be processed in the same
order they were received in the batch (even when using a `concurrency` value of
`1`).

### Partial Batch Responses

All of the handlers in `@lifeomic/delta` support returning [partial batch responses](https://docs.aws.amazon.com/prescriptive-guidance/latest/lambda-event-filtering-partial-batch-responses-for-sqs/best-practices-partial-batch-responses.html). This behavior can be enabled
by specifying the `usePartialBatchResponses` configuration option:

```typescript
// Dynamo
const stream = new DynamoStreamHandler({
// ...
usePartialBatchResponses: true,
});

// Kinesis
const stream = new KinesisEventHandler({
// ...
usePartialBatchResponses: true,
});

// SQS
const stream = new SQSMessageHandler({
// ...
usePartialBatchResponses: true,
});
```

When `usePartialBatchResponses` is enabled, the handler will return a set of
`batchItemFailures`. If events are ordered, ordering is preserved correctly.

**Note**: When enabling this option, be sure to _also_ configure the correct
[`FunctionResponseTypes`](https://docs.aws.amazon.com/lambda/latest/api/API_CreateEventSourceMapping.html#lambda-CreateEventSourceMapping-request-FunctionResponseTypes) in your Lambda event source mapping.
Loading