Skip to content

Commit 14b2f26

Browse files
author
Teun Willems
committed
add docs and run prettier
1 parent 4eb67ec commit 14b2f26

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

docs/events/kafka.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@ functions:
153153
- eventName: INSERT
154154
```
155155

156+
## Failure destinations
157+
158+
A failure destination allows you to send messages that failed processing repeatedly to be sent to an SNS Topic, SQS Queue or another lambda function.
159+
By default, Lambda discards oversized records (> 6MB) and records that fail all retry attempts.
160+
Configuring an on-failure destination ensures that you don't lose data when your Lambda function encounters errors.
161+
For more information, see [capturing discarded batches for a self-managed Apache Kafka event source](https://docs.aws.amazon.com/lambda/latest/dg/with-kafka-on-failure.html)
162+
163+
```yml
164+
functions:
165+
compute:
166+
handler: handler.compute
167+
events:
168+
- kafka:
169+
accessConfigurations:
170+
saslScram512Auth: arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName
171+
topic: MySelfManagedKafkaTopic
172+
onFailureDestination: arn:aws:sqs:us-east-1:01234567890:my-queue
173+
```
174+
156175
## IAM Permissions
157176

158177
The Serverless Framework will automatically configure the most minimal set of IAM permissions for you. However you can still add additional permissions if you need to. Read the official [AWS documentation](https://docs.aws.amazon.com/lambda/latest/dg/kafka-smaa.html) for more information about IAM Permissions for Kafka events.

test/unit/lib/plugins/aws/package/compile/events/kafka.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ describe('test/unit/lib/plugins/aws/package/compile/events/kafka.test.js', () =>
564564
topic,
565565
bootstrapServers: ['abc.xyz:9092'],
566566
accessConfigurations: { saslScram256Auth: saslScram256AuthArn },
567-
onFailureDestination: 'arn:aws:sqs:eu-central-1:000000000000:some-queue'
567+
onFailureDestination: 'arn:aws:sqs:eu-central-1:000000000000:some-queue',
568568
},
569569
},
570570
],
@@ -576,7 +576,9 @@ describe('test/unit/lib/plugins/aws/package/compile/events/kafka.test.js', () =>
576576

577577
const eventSourceMappingResource =
578578
cfTemplate.Resources[awsNaming.getKafkaEventLogicalId('basic', 'TestingTopic')];
579-
expect(eventSourceMappingResource.Properties.DestinationConfig.OnFailure.Destination).to.equal('arn:aws:sqs:eu-central-1:000000000000:some-queue');
579+
expect(
580+
eventSourceMappingResource.Properties.DestinationConfig.OnFailure.Destination
581+
).to.equal('arn:aws:sqs:eu-central-1:000000000000:some-queue');
580582
});
581583
});
582584

0 commit comments

Comments
 (0)