Interface ListenerContainerWithDlqAndRetryCustomizer

All Superinterfaces:
org.springframework.cloud.stream.config.ListenerContainerCustomizer<org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?>>

public interface ListenerContainerWithDlqAndRetryCustomizer extends org.springframework.cloud.stream.config.ListenerContainerCustomizer<org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?>>
An extension of ListenerContainerCustomizer that provides access to dead letter metadata.
Since:
3.2
Author:
Gary Russell, Soby Chacko
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group)
    API method for configuring the container that also gives access to the ExtendedConsumerProperties for the binding.
    void
    configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group, BiFunction<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception,org.apache.kafka.common.TopicPartition> dlqDestinationResolver, org.springframework.util.backoff.BackOff backOff)
    Configure the container.
    default void
    configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group, BiFunction<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception,org.apache.kafka.common.TopicPartition> dlqDestinationResolver, org.springframework.util.backoff.BackOff backOff, org.springframework.cloud.stream.binder.ExtendedConsumerProperties<org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties> extendedConsumerProperties)
    API method for configuring the container that also gives access to the ExtendedConsumerProperties for the binding.
    default boolean
    retryAndDlqInBinding(String destinationName, String group)
    Return false to move retries and DLQ from the binding to a customized error handler using the retry metadata and/or a DeadLetterPublishingRecoverer when configured via configure(AbstractMessageListenerContainer, String, String, BiFunction, BackOff).
  • Method Details

    • configure

      default void configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group)
      API method for configuring the container that also gives access to the ExtendedConsumerProperties for the binding.
      Specified by:
      configure in interface org.springframework.cloud.stream.config.ListenerContainerCustomizer<org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?>>
      Parameters:
      container - the container.
      destinationName - the destination name.
      group - the consumer group.
    • configure

      void configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group, @Nullable BiFunction<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception,org.apache.kafka.common.TopicPartition> dlqDestinationResolver, @Nullable org.springframework.util.backoff.BackOff backOff)
      Configure the container.
      Parameters:
      container - the container.
      destinationName - the destination name.
      group - the group.
      dlqDestinationResolver - a destination resolver for the dead letter topic (if enableDlq).
      backOff - the backOff using retry properties (if configured).
      See Also:
    • configure

      default void configure(org.springframework.kafka.listener.AbstractMessageListenerContainer<?,?> container, String destinationName, String group, @Nullable BiFunction<org.apache.kafka.clients.consumer.ConsumerRecord<?,?>,Exception,org.apache.kafka.common.TopicPartition> dlqDestinationResolver, @Nullable org.springframework.util.backoff.BackOff backOff, org.springframework.cloud.stream.binder.ExtendedConsumerProperties<org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties> extendedConsumerProperties)
      API method for configuring the container that also gives access to the ExtendedConsumerProperties for the binding.
      Parameters:
      container - the container.
      destinationName - the destination name.
      group - the consumer group.
      dlqDestinationResolver - a destination resolver for the dead letter topic (if enableDlq).
      backOff - the backOff using retry properties (if configured).
      extendedConsumerProperties - extended binding consumer properties.
      Since:
      4.2.0
    • retryAndDlqInBinding

      default boolean retryAndDlqInBinding(String destinationName, String group)
      Return false to move retries and DLQ from the binding to a customized error handler using the retry metadata and/or a DeadLetterPublishingRecoverer when configured via configure(AbstractMessageListenerContainer, String, String, BiFunction, BackOff).
      Parameters:
      destinationName - the destination name.
      group - the group.
      Returns:
      false to disable retries and DLQ in the binding