Add Kafka partial batch failure response types - #1164
Conversation
| /// The topic-partition key from the Kafka event's `records` map. | ||
| pub partition: String, | ||
| /// The Kafka record offset. | ||
| pub offset: i64, |
There was a problem hiding this comment.
partition and offset must match the record that failed in the current Kafka batch. An invalid topic-partition key or offset can cause Lambda to retry the entire batch, so please document the expected format—for example, partition: "topic-3"—and clarify that offset must be the original record offset.
| /// Set all failed Kafka item identifiers in the batch response. | ||
| /// | ||
| /// This replaces any previously registered failures. | ||
| pub fn set_failures<I>(&mut self, item_identifiers: I) |
There was a problem hiding this comment.
The method documentation says that set_failures replaces previously registered failures, but the current test only calls it on an empty response. Could you update the test to add an initial failure first, call set_failures, and verify that only the new failures remain?
|
|
||
| #[test] | ||
| #[cfg(feature = "kafka")] | ||
| fn kafka_event_response_serializes_item_identifiers() { |
There was a problem hiding this comment.
Could you add a test that parses the expected Kafka partial-batch response JSON and verifies the resulting KafkaEventResponse? A serialization round-trip test would also help catch incorrect serde field names or types.
📬 Issue #, if available:
✍️ Description of changes:
Add support to handle batch item failures for kafka trigger. See https://docs.aws.amazon.com/lambda/latest/dg/kafka-retry-configurations.html for more info
🔏 By submitting this pull request
cargo +nightly fmt.cargo clippy --fix.