You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When processing `ConsumerRecord` with the `BatchListener`, the `KafkaHeaders.DELIVERY_ATTEMPT` header can be present in a different way compared to `SingleRecordListener`.
5
+
6
+
To inject the `KafkaHeaders.DELIVERY_ATTEMPT` header into `ConsumerRecord` when using the `BatchListener`, set the `DeliveryAttemptAwareRetryListener` as the `RetryListener` in the `ErrorHandler`.
7
+
8
+
Please refer to the code below.
9
+
[source, java]
10
+
----
11
+
final FixedBackOff fixedBackOff = new FixedBackOff(1, 10);
12
+
final DefaultErrorHandler errorHandler = new DefaultErrorHandler(fixedBackOff);
Copy file name to clipboardExpand all lines: spring-kafka-docs/src/main/antora/modules/ROOT/pages/whats-new.adoc
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,4 +49,10 @@ When using `DeadLetterPublishingRecovererFactory`, the user applications can ove
49
49
[[x33-customize-kafka-streams-implementation]]
50
50
=== Customizing The Implementation of Kafka Streams
51
51
52
-
When using `KafkaStreamsCustomizer` it is now possible to return a custom implementation of the `KafkaStreams` object by overriding the `initKafkaStreams` method.
52
+
When using `KafkaStreamsCustomizer` it is now possible to return a custom implementation of the `KafkaStreams` object by overriding the `initKafkaStreams` method.
53
+
54
+
[[x33-kafka-headers-for-batch-listeners]]
55
+
=== KafkaHeaders.DELIVERY_ATTEMPT for batch listeners
56
+
When using a `BatchListener`, the `ConsumerRecord` can have the `KafkaHeaders.DELIVERY_ATTMPT` header in its headers fields.
57
+
If the `DeliveryAttemptAwareRetryListener` is set to error handler as retry listener, each `ConsumerRecord` has delivery attempt header.
58
+
For more details, see xref:retrytopic/kafka-headers-for-batch-listener.adoc[kafka-headers-for-batch-listener].
Copy file name to clipboardExpand all lines: spring-kafka/src/test/java/org/springframework/kafka/listener/DeliveryAttemptAwareRetryListenerIntegrationTests.java
0 commit comments