MCPcopy Create free account
hub / github.com/aws/aws-lambda-rust-runtime / set_failures

Method set_failures

lambda-events/src/event/streams/mod.rs:55–69  ·  view source on GitHub ↗

Set multiple failed item identifiers at once. This is a convenience method for setting all batch item failures in one call. It replaces any previously registered failures. Besides `item_identifiers`, the generated struct will use default field values for [`KinesisBatchItemFailure`]. Important**: This feature requires `FunctionResponseTypes: ReportBatchItemFailures` to be enabled in your Lambda

(&mut self, item_identifiers: I)

Source from the content-addressed store, hash-verified

53 /// to be enabled in your Lambda function's Kinesis event source mapping configuration.
54 /// Without this setting, Lambda will retry the entire batch on any failure.
55 pub fn set_failures<I, S>(&mut self, item_identifiers: I)
56 where
57 I: IntoIterator<Item = S>,
58 S: Into<String>,
59 {
60 self.batch_item_failures = item_identifiers
61 .into_iter()
62 .map(|id| KinesisBatchItemFailure {
63 item_identifier: Some(id.into()),
64 #[cfg(feature = "catch-all-fields")]
65 other: serde_json::Map::new(),
66 ..Default::default()
67 })
68 .collect();
69 }
70}
71
72/// `KinesisBatchItemFailure` is the individual record which failed processing.

Callers 1

Calls 1

collectMethod · 0.80

Tested by 1