Annotation Type RetryableTopic
-
@Target(METHOD) @Retention(RUNTIME) @Documented public @interface RetryableTopicAnnotation to create the retry and dlt topics for aKafkaListenerannotated listener. SeeRetryTopicConfigurerfor usage examples. All String properties can be resolved from property placeholders${...}or SpEL expressions#{...}.- Since:
- 2.7
- Author:
- Tomaz Fernandes, Gary Russell
- See Also:
RetryTopicConfigurer
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.StringattemptsThe number of attempts made before the message is sent to the DLT.java.lang.StringautoCreateTopicsWhether or not the topics should be created after registration with the provided configurations.org.springframework.retry.annotation.BackoffbackoffSpecify the backoff properties for retrying this operation.DltStrategydltStrategyWhether or not create a DLT, and redeliver to the DLT if delivery fails or just give up.java.lang.StringdltTopicSuffixThe suffix that will be appended to the main topic in order to generate the dlt topic.java.lang.Class<? extends java.lang.Throwable>[]excludeThe exception types that should not be retried.java.lang.String[]excludeNamesThe exception class names that should not be retried.FixedDelayStrategyfixedDelayTopicStrategyWhether to use a single or multiple topics when using a fixed delay.java.lang.Class<? extends java.lang.Throwable>[]includeThe exception types that should be retried.java.lang.String[]includeNamesThe exception class names that should be retried.java.lang.StringkafkaTemplateThe bean name of theKafkaTemplatebean that will be used to forward the message to the retry and Dlt topics.java.lang.StringlistenerContainerFactoryThe bean name of theConcurrentKafkaListenerContainerFactorythat will be used to create the consumers for the retry and dlt topics.java.lang.StringnumPartitionsThe number of partitions for the automatically created topics.java.lang.StringreplicationFactorThe replication factor for the automatically created topics.java.lang.StringretryTopicSuffixThe suffix that will be appended to the main topic in order to generate the retry topics.java.lang.StringtimeoutThe amount of time in milliseconds after which message retrying should give up and send the message to the DLT.TopicSuffixingStrategytopicSuffixingStrategyWhether the retry topics will be suffixed with the delay value for that topic or a simple index.java.lang.StringtraversingCausesWhether or not the captured exception should be traversed to look for the exceptions provided above.
-
-
-
-
backoff
org.springframework.retry.annotation.Backoff backoff
Specify the backoff properties for retrying this operation. The default is a simpleBackoffspecification with no properties - see it's documentation for defaults.- Returns:
- a backoff specification
- Default:
- @org.springframework.retry.annotation.Backoff
-
-
-
kafkaTemplate
java.lang.String kafkaTemplate
The bean name of theKafkaTemplatebean that will be used to forward the message to the retry and Dlt topics. If not specified, a bean with nameretryTopicDefaultKafkaTemplateorkafkaTemplatewill be looked up.- Returns:
- the kafkaTemplate bean name.
- Default:
- ""
-
-
-
listenerContainerFactory
java.lang.String listenerContainerFactory
The bean name of theConcurrentKafkaListenerContainerFactorythat will be used to create the consumers for the retry and dlt topics. If none is provided, the one from theKafkaListenerannotation is used, or else a default one, if any.- Returns:
- the listenerContainerFactory bean name.
- Default:
- ""
-
-
-
autoCreateTopics
java.lang.String autoCreateTopics
Whether or not the topics should be created after registration with the provided configurations. Not to be confused with the ConsumerConfig.ALLOW_AUTO_CREATE_TOPICS_CONFIG from Kafka configuration, which is handled by theKafkaConsumer. Expressions must resolve to a boolean or a String that can be parsed as such.- Returns:
- the configuration.
- Default:
- "true"
-
-
-
traversingCauses
java.lang.String traversingCauses
Whether or not the captured exception should be traversed to look for the exceptions provided above. Expressions must resolve to a boolean or a String that can be parsed as such. Default true wheninclude()orexclude()provided; false otherwise.- Returns:
- the value.
- Default:
- ""
-
-
-
topicSuffixingStrategy
TopicSuffixingStrategy topicSuffixingStrategy
Whether the retry topics will be suffixed with the delay value for that topic or a simple index.- Returns:
- the strategy.
- Default:
- org.springframework.kafka.retrytopic.TopicSuffixingStrategy.SUFFIX_WITH_DELAY_VALUE
-
-
-
dltStrategy
DltStrategy dltStrategy
Whether or not create a DLT, and redeliver to the DLT if delivery fails or just give up.- Returns:
- the dlt strategy.
- Default:
- org.springframework.kafka.retrytopic.DltStrategy.ALWAYS_RETRY_ON_ERROR
-
-
-
fixedDelayTopicStrategy
FixedDelayStrategy fixedDelayTopicStrategy
Whether to use a single or multiple topics when using a fixed delay.- Returns:
- the fixed delay strategy.
- Default:
- org.springframework.kafka.retrytopic.FixedDelayStrategy.MULTIPLE_TOPICS
-
-