Skip to content

Commit 172de5e

Browse files
authored
Correct non-blocking retries docs (#3707)
* Corrected RetryConfigurationSupport to RetryTopicConfigurationSupport in features.adoc, how-the-pattern-works.adoc retry-config.adoc. * Added quotes("") for string-type attributes in @RetryableTopic (e.g., traversingCauses, numPartitions, autoCreateTopics). * Updated RetryTopicConfigurationBuilder methods to use List for arguments (e.g., includeTopics(), excludeTopics()).
1 parent 637a0d0 commit 172de5e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Diff for: spring-kafka-docs/src/main/antora/modules/ROOT/pages/retrytopic/features.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ You can also set it to traverse the causes to lookup nested exceptions.
9797

9898
[source, java]
9999
----
100-
@RetryableTopic(include = {MyRetryException.class, MyOtherRetryException.class}, traversingCauses = true)
100+
@RetryableTopic(include = {MyRetryException.class, MyOtherRetryException.class}, traversingCauses = "true")
101101
@KafkaListener(topics = "my-annotated-topic")
102102
public void processMessage(MyPojo message) {
103103
throw new RuntimeException(new MyRetryException()); // will retry
@@ -175,13 +175,13 @@ IMPORTANT: Note that if you're not using Spring Boot you'll have to provide a Ka
175175

176176
[source, java]
177177
----
178-
@RetryableTopic(numPartitions = 2, replicationFactor = 3)
178+
@RetryableTopic(numPartitions = "2", replicationFactor = "3")
179179
@KafkaListener(topics = "my-annotated-topic")
180180
public void processMessage(MyPojo message) {
181181
// ... message processing
182182
}
183183
184-
@RetryableTopic(autoCreateTopics = false)
184+
@RetryableTopic(autoCreateTopics = "false")
185185
@KafkaListener(topics = "my-annotated-topic")
186186
public void processMessage(MyPojo message) {
187187
// ... message processing
@@ -245,7 +245,7 @@ Starting with version 2.9.5, if the `Headers` returned by the function contains
245245

246246
As can be seen in xref:retrytopic/features.adoc#retry-headers[Failure Header Management] it is possible to customize the default `DeadLetterPublishingRecoverer` instances created by the framework.
247247
However, for some use cases, it is necessary to subclass the `DeadLetterPublishingRecoverer`, for example to override `createProducerRecord()` to modify the contents sent to the retry (or dead-letter) topics.
248-
Starting with version 3.0.9, you can override the `RetryConfigurationSupport.configureDeadLetterPublishingContainerFactory()` method to provide a `DeadLetterPublisherCreator` instance, for example:
248+
Starting with version 3.0.9, you can override the `RetryTopicConfigurationSupport.configureDeadLetterPublishingContainerFactory()` method to provide a `DeadLetterPublisherCreator` instance, for example:
249249

250250
[source, java]
251251
----

Diff for: spring-kafka-docs/src/main/antora/modules/ROOT/pages/retrytopic/how-the-pattern-works.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ IMPORTANT: You can set the `AckMode` mode you prefer, but `RECORD` is suggested.
1515

1616
When using a manual `AckMode` with `asyncAcks` set to true, the `DefaultErrorHandler` must be configured with `seekAfterError` set to `false`.
1717
Starting with versions 2.9.10, 3.0.8, this will be set to `false` unconditionally for such configurations.
18-
With earlier versions, it was necessary to override the `RetryConfigurationSupport.configureCustomizers()` method to set the property to `false`.
18+
With earlier versions, it was necessary to override the `RetryTopicConfigurationSupport.configureCustomizers()` method to set the property to `false`.
1919

2020
[source, java]
2121
----

Diff for: spring-kafka-docs/src/main/antora/modules/ROOT/pages/retrytopic/retry-config.adoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Also, starting with that version, for more advanced configuration of the feature
1010
For more details refer to xref:retrytopic/retry-config.adoc#retry-topic-global-settings[Configuring Global Settings and Features].
1111

1212
By default, the containers for the retry topics will have the same concurrency as the main container.
13-
Starting with version 3.0, you can set a different `concurrency` for the retry containers (either on the annotation, or in `RetryConfigurationBuilder`).
13+
Starting with version 3.0, you can set a different `concurrency` for the retry containers (either on the annotation, or in `RetryTopicConfigurationBuilder`).
1414

1515
IMPORTANT: Only one of the above techniques can be used, and only one `@Configuration` class can extend `RetryTopicConfigurationSupport`.
1616

@@ -100,7 +100,7 @@ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> templa
100100
.fixedBackOff(3000)
101101
.maxAttempts(5)
102102
.concurrency(1)
103-
.includeTopics("my-topic", "my-other-topic")
103+
.includeTopics(List.of("my-topic", "my-other-topic"))
104104
.create(template);
105105
}
106106
@@ -110,7 +110,7 @@ public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<String, MyOtherPo
110110
.newInstance()
111111
.exponentialBackoff(1000, 2, 5000)
112112
.maxAttempts(4)
113-
.excludeTopics("my-topic", "my-other-topic")
113+
.excludeTopics(List.of("my-topic", "my-other-topic"))
114114
.retryOn(MyException.class)
115115
.create(template);
116116
}
@@ -234,4 +234,4 @@ public RetryTopicConfiguration myRetryTopic() {
234234
public static class AnnotatedClass {
235235
// NoOps
236236
}
237-
----
237+
----

Diff for: spring-kafka/src/main/java/org/springframework/kafka/retrytopic/RetryTopicConfigurer.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2018-2024 the original author or authors.
2+
* Copyright 2018-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@
118118
* .newInstance()
119119
* .fixedBackOff(3000)
120120
* .maxAttempts(5)
121-
* .includeTopics("my-topic", "my-other-topic")
121+
* .includeTopics(List.of("my-topic", "my-other-topic"))
122122
* .create(template);
123123
* }</code>
124124
* </pre>
@@ -129,7 +129,7 @@
129129
* .newInstance()
130130
* .exponentialBackoff(1000, 2, 5000)
131131
* .maxAttempts(4)
132-
* .excludeTopics("my-topic", "my-other-topic")
132+
* .excludeTopics(List.of("my-topic", "my-other-topic"))
133133
* .retryOn(MyException.class)
134134
* .create(template);
135135
* }</code>

0 commit comments

Comments
 (0)