Skip to content

Commit

Permalink
Merge pull request #76 from lifeomic/partial-batch-response-docs
Browse files Browse the repository at this point in the history
docs: add docs about partial batch responses
  • Loading branch information
swain authored May 28, 2024
2 parents 96737df + 39dfe36 commit be253ec
Showing 1 changed file with 31 additions and 0 deletions.
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.

0 comments on commit be253ec

Please sign in to comment.