Annotation Interface RetryableTopic


@Target(METHOD) @Retention(RUNTIME) @Documented public @interface RetryableTopic
Annotation to create the retry and dlt topics for a KafkaListener annotated listener. See RetryTopicConfigurer for usage examples. All String properties can be resolved from property placeholders ${...} or SpEL expressions #{...}.
Since:
2.7
Author:
Tomaz Fernandes, Gary Russell
See Also:
  • Element Details

    • attempts

      String attempts
      The number of attempts made before the message is sent to the DLT. Expressions must resolve to an integer or a string that can be parsed as such. Default 3.
      Returns:
      the number of attempts.
      Default:
      "3"
    • backoff

      org.springframework.retry.annotation.Backoff backoff
      Specify the backoff properties for retrying this operation. The default is a simple Backoff specification with no properties - see it's documentation for defaults.
      Returns:
      a backoff specification
      Default:
      @org.springframework.retry.annotation.Backoff
    • timeout

      String timeout
      The amount of time in milliseconds after which message retrying should give up and send the message to the DLT. Expressions must resolv to a long or a String that can be parsed as such.
      Returns:
      the timeout value.
      Default:
      ""
    • kafkaTemplate

      String kafkaTemplate
      The bean name of the KafkaTemplate bean that will be used to forward the message to the retry and Dlt topics. If not specified, a bean with name retryTopicDefaultKafkaTemplate or kafkaTemplate will be looked up.
      Returns:
      the kafkaTemplate bean name.
      Default:
      ""
    • listenerContainerFactory

      String listenerContainerFactory
      The bean name of the ConcurrentKafkaListenerContainerFactory that will be used to create the consumers for the retry and dlt topics. If none is provided, the one from the KafkaListener annotation is used, or else a default one, if any.
      Returns:
      the listenerContainerFactory bean name.
      Default:
      ""
    • autoCreateTopics

      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 the KafkaConsumer. Expressions must resolve to a boolean or a String that can be parsed as such.
      Returns:
      the configuration.
      Default:
      "true"
    • numPartitions

      String numPartitions
      The number of partitions for the automatically created topics. Expressions must resolve to an integer or a String that can be parsed as such. Default 1.
      Returns:
      the number of partitions.
      Default:
      "1"
    • replicationFactor

      String replicationFactor
      The replication factor for the automatically created topics. Expressions must resolve to a short or a String that can be parsed as such.
      Returns:
      the replication factor.
      Default:
      "1"
    • include

      Class<? extends Throwable>[] include
      The exception types that should be retried.
      Returns:
      the exceptions.
      Default:
      {}
    • exclude

      Class<? extends Throwable>[] exclude
      The exception types that should not be retried. When the message processing throws these exceptions the message goes straight to the DLT.
      Returns:
      the exceptions not to be retried.
      Default:
      {}
    • includeNames

      String[] includeNames
      The exception class names that should be retried.
      Returns:
      the exceptions.
      Default:
      {}
    • excludeNames

      String[] excludeNames
      The exception class names that should not be retried. When the message processing throws these exceptions the message goes straight to the DLT.
      Returns:
      the exceptions not to be retried.
      Default:
      {}
    • traversingCauses

      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 when include() or exclude() provided; false otherwise.
      Returns:
      the value.
      Default:
      ""
    • retryTopicSuffix

      String retryTopicSuffix
      The suffix that will be appended to the main topic in order to generate the retry topics. The corresponding delay value is also appended.
      Returns:
      the retry topics' suffix.
      Default:
      "-retry"
    • dltTopicSuffix

      String dltTopicSuffix
      The suffix that will be appended to the main topic in order to generate the dlt topic.
      Returns:
      the dlt suffix.
      Default:
      "-dlt"
    • 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:
      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:
      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:
      MULTIPLE_TOPICS
    • autoStartDltHandler

      String autoStartDltHandler
      Override the container factory's autoStartup property for just the DLT container. Usually used to not start the DLT container when autoStartup is true.
      Returns:
      whether or not to override the factory.
      Since:
      2.8
      Default:
      ""