Class DeadLetterPublishingRecovererFactory
- java.lang.Object
-
- org.springframework.kafka.retrytopic.DeadLetterPublishingRecovererFactory
-
public class DeadLetterPublishingRecovererFactory extends java.lang.ObjectCreates and configures theDeadLetterPublishingRecovererthat will be used to forward the messages using theDestinationTopicResolver.- Since:
- 2.7
- Author:
- Tomaz Fernandes
-
-
Constructor Summary
Constructors Constructor Description DeadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeadLetterPublishingRecoverercreate()protected org.apache.kafka.common.TopicPartitionresolveTopicPartition(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> cr, DestinationTopic nextDestination)Creates and returns theTopicPartition, where the original record should be forwarded.voidsetDeadLetterPublishingRecovererCustomizer(java.util.function.Consumer<DeadLetterPublishingRecoverer> customizer)
-
-
-
Constructor Detail
-
DeadLetterPublishingRecovererFactory
public DeadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver)
-
-
Method Detail
-
create
public DeadLetterPublishingRecoverer create()
-
setDeadLetterPublishingRecovererCustomizer
public void setDeadLetterPublishingRecovererCustomizer(java.util.function.Consumer<DeadLetterPublishingRecoverer> customizer)
-
resolveTopicPartition
protected org.apache.kafka.common.TopicPartition resolveTopicPartition(org.apache.kafka.clients.consumer.ConsumerRecord<?,?> cr, DestinationTopic nextDestination)Creates and returns theTopicPartition, where the original record should be forwarded. By default, it will use the partition same as original record's partition, in the next destination topic.DeadLetterPublishingRecoverer.checkPartition(org.apache.kafka.common.TopicPartition, org.apache.kafka.clients.consumer.Consumer<?, ?>)has logic to check whether that partition exists, and if it doesn't it sets -1, to allow the Producer itself to assign a partition to the record.Subclasses can inherit from this method to override the implementation, if necessary.
- Parameters:
cr- The originalConsumerRecord, which is to be forwarded to DLTnextDestination- The nextDestinationTopic, where the consumerRecord is to be forwarded- Returns:
- An instance of
TopicPartition, specifying the topic and partition, where the cr is to be sent
-
-