Skip to content

Commit

Permalink
Correct non-blocking retries docs (#3707)
Browse files Browse the repository at this point in the history
* 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()).
  • Loading branch information
bky373 authored Jan 13, 2025
1 parent 637a0d0 commit 172de5e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ You can also set it to traverse the causes to lookup nested exceptions.

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

[source, java]
----
@RetryableTopic(numPartitions = 2, replicationFactor = 3)
@RetryableTopic(numPartitions = "2", replicationFactor = "3")
@KafkaListener(topics = "my-annotated-topic")
public void processMessage(MyPojo message) {
// ... message processing
}
@RetryableTopic(autoCreateTopics = false)
@RetryableTopic(autoCreateTopics = "false")
@KafkaListener(topics = "my-annotated-topic")
public void processMessage(MyPojo message) {
// ... message processing
Expand Down Expand Up @@ -245,7 +245,7 @@ Starting with version 2.9.5, if the `Headers` returned by the function contains

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.
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.
Starting with version 3.0.9, you can override the `RetryConfigurationSupport.configureDeadLetterPublishingContainerFactory()` method to provide a `DeadLetterPublisherCreator` instance, for example:
Starting with version 3.0.9, you can override the `RetryTopicConfigurationSupport.configureDeadLetterPublishingContainerFactory()` method to provide a `DeadLetterPublisherCreator` instance, for example:

[source, java]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ IMPORTANT: You can set the `AckMode` mode you prefer, but `RECORD` is suggested.

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

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

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

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

Expand Down Expand Up @@ -100,7 +100,7 @@ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> templa
.fixedBackOff(3000)
.maxAttempts(5)
.concurrency(1)
.includeTopics("my-topic", "my-other-topic")
.includeTopics(List.of("my-topic", "my-other-topic"))
.create(template);
}
Expand All @@ -110,7 +110,7 @@ public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<String, MyOtherPo
.newInstance()
.exponentialBackoff(1000, 2, 5000)
.maxAttempts(4)
.excludeTopics("my-topic", "my-other-topic")
.excludeTopics(List.of("my-topic", "my-other-topic"))
.retryOn(MyException.class)
.create(template);
}
Expand Down Expand Up @@ -234,4 +234,4 @@ public RetryTopicConfiguration myRetryTopic() {
public static class AnnotatedClass {
// NoOps
}
----
----
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018-2024 the original author or authors.
* Copyright 2018-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -118,7 +118,7 @@
* .newInstance()
* .fixedBackOff(3000)
* .maxAttempts(5)
* .includeTopics("my-topic", "my-other-topic")
* .includeTopics(List.of("my-topic", "my-other-topic"))
* .create(template);
* }</code>
* </pre>
Expand All @@ -129,7 +129,7 @@
* .newInstance()
* .exponentialBackoff(1000, 2, 5000)
* .maxAttempts(4)
* .excludeTopics("my-topic", "my-other-topic")
* .excludeTopics(List.of("my-topic", "my-other-topic"))
* .retryOn(MyException.class)
* .create(template);
* }</code>
Expand Down

0 comments on commit 172de5e

Please sign in to comment.