Skip to content

Add Kafka partial batch failure response types - #1164

Open
FalkWoldmann wants to merge 1 commit into
aws:mainfrom
FalkWoldmann:feat/kafka-partial-batch-response
Open

Add Kafka partial batch failure response types#1164
FalkWoldmann wants to merge 1 commit into
aws:mainfrom
FalkWoldmann:feat/kafka-partial-batch-response

Conversation

@FalkWoldmann

@FalkWoldmann FalkWoldmann commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

📬 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

  • I confirm that I've ran cargo +nightly fmt.
  • I confirm that I've ran cargo clippy --fix.
  • I confirm that I've made a best effort attempt to update all relevant documentation.
  • I confirm that my contribution is made under the terms of the Apache 2.0 license.

/// The topic-partition key from the Kafka event's `records` map.
pub partition: String,
/// The Kafka record offset.
pub offset: i64,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

https://docs.aws.amazon.com/lambda/latest/dg/kafka-retry-configurations.html#kafka-partial-batch-response

/// 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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants