Class RetryTopicComponentFactory
java.lang.Object
org.springframework.kafka.retrytopic.RetryTopicComponentFactory
Provide the component instances that will be used with
RetryTopicConfigurationSupport
. Override any of the methods to provide
a different implementation or subclass, then override the
RetryTopicConfigurationSupport.createComponentFactory()
method
to return this factory's subclass.- Since:
- 2.9
- Author:
- Tomaz Fernandes
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Clock
Create aClock
instance that will be used for all time-related operations in the retry topic processes.deadLetterPublishingRecovererFactory
(DestinationTopicResolver destinationTopicResolver) Create theDeadLetterPublishingRecovererFactory
that will be used to create theDeadLetterPublishingRecoverer
to forward the records to a givenDestinationTopic
.destinationTopicProcessor
(DestinationTopicResolver destinationTopicResolver) Create theDestinationTopicProcessor
that will be used to process theDestinationTopic
instances and store them in the providedDestinationTopicResolver
.Create the instance ofDestinationTopicResolver
that will be used to store theDestinationTopic
instance and resolve which a given record should be forwarded to.Return theClock
instance that will be used for all time-related operations in the retry topic processes.kafkaBackOffManagerFactory
(ListenerContainerRegistry registry, ApplicationContext applicationContext) Create theKafkaBackOffManagerFactory
that will be used to create theKafkaConsumerBackoffManager
instance used to back off the partitions.listenerContainerFactoryConfigurer
(KafkaConsumerBackoffManager kafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory, Clock clock) Create aListenerContainerFactoryConfigurer
that will be used to configure theKafkaListenerContainerFactory
resolved by theListenerContainerFactoryResolver
.listenerContainerFactoryResolver
(BeanFactory beanFactory) Create theListenerContainerFactoryResolver
that will be used to resolve the appropriateKafkaListenerContainerFactory
for a given topic.retryTopicConfigurer
(DestinationTopicProcessor destinationTopicProcessor, ListenerContainerFactoryConfigurer listenerContainerFactoryConfigurer, ListenerContainerFactoryResolver factoryResolver, RetryTopicNamesProviderFactory retryTopicNamesProviderFactory) Create theRetryTopicConfigurer
that will serve as an entry point for configuring non-blocking topic-based delayed retries for a givenKafkaListenerEndpoint
, by processing the appropriateRetryTopicConfiguration
.Create theRetryTopicNamesProviderFactory
instance that will be used to provide the property names for the retry topics'KafkaListenerEndpoint
.
-
Constructor Details
-
RetryTopicComponentFactory
public RetryTopicComponentFactory()
-
-
Method Details
-
retryTopicConfigurer
public RetryTopicConfigurer retryTopicConfigurer(DestinationTopicProcessor destinationTopicProcessor, ListenerContainerFactoryConfigurer listenerContainerFactoryConfigurer, ListenerContainerFactoryResolver factoryResolver, RetryTopicNamesProviderFactory retryTopicNamesProviderFactory) Create theRetryTopicConfigurer
that will serve as an entry point for configuring non-blocking topic-based delayed retries for a givenKafkaListenerEndpoint
, by processing the appropriateRetryTopicConfiguration
.- Parameters:
destinationTopicProcessor
- theDestinationTopicProcessor
that will be used to process theDestinationTopic
instances and register them in aDestinationTopicContainer
.listenerContainerFactoryConfigurer
- theListenerContainerFactoryConfigurer
that will be used to configure theKafkaListenerContainerFactory
instances for the non-blocking delayed retries feature.factoryResolver
- theListenerContainerFactoryResolver
that will be used to resolve the properKafkaListenerContainerFactory
for a given endpoint or its retry topics.retryTopicNamesProviderFactory
- theRetryTopicNamesProviderFactory
that will be used to provide the property names for the retry topics' endpoints.- Returns:
- the instance.
-
destinationTopicProcessor
public DestinationTopicProcessor destinationTopicProcessor(DestinationTopicResolver destinationTopicResolver) Create theDestinationTopicProcessor
that will be used to process theDestinationTopic
instances and store them in the providedDestinationTopicResolver
.- Parameters:
destinationTopicResolver
- theDestinationTopicResolver
instance to be used to store theDestinationTopic
instances.- Returns:
- the instance.
-
destinationTopicResolver
Create the instance ofDestinationTopicResolver
that will be used to store theDestinationTopic
instance and resolve which a given record should be forwarded to.- Returns:
- the instance.
-
deadLetterPublishingRecovererFactory
public DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver) Create theDeadLetterPublishingRecovererFactory
that will be used to create theDeadLetterPublishingRecoverer
to forward the records to a givenDestinationTopic
.- Parameters:
destinationTopicResolver
- theDestinationTopicResolver
instance to resolve the destinations.- Returns:
- the instance.
-
listenerContainerFactoryResolver
Create theListenerContainerFactoryResolver
that will be used to resolve the appropriateKafkaListenerContainerFactory
for a given topic.- Parameters:
beanFactory
- theBeanFactory
that will be used to retrieve theKafkaListenerContainerFactory
instance if necessary.- Returns:
- the instance.
-
listenerContainerFactoryConfigurer
public ListenerContainerFactoryConfigurer listenerContainerFactoryConfigurer(KafkaConsumerBackoffManager kafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory, Clock clock) Create aListenerContainerFactoryConfigurer
that will be used to configure theKafkaListenerContainerFactory
resolved by theListenerContainerFactoryResolver
.- Parameters:
kafkaConsumerBackoffManager
- theKafkaConsumerBackoffManager
used with theKafkaBackoffAwareMessageListenerAdapter
.deadLetterPublishingRecovererFactory
- the factory that will provide theDeadLetterPublishingRecoverer
instance to be used.clock
- theClock
instance to be used with the listener adapter.- Returns:
- the instance.
-
retryTopicNamesProviderFactory
Create theRetryTopicNamesProviderFactory
instance that will be used to provide the property names for the retry topics'KafkaListenerEndpoint
.- Returns:
- the instance.
-
kafkaBackOffManagerFactory
public KafkaBackOffManagerFactory kafkaBackOffManagerFactory(@Nullable ListenerContainerRegistry registry, ApplicationContext applicationContext) Create theKafkaBackOffManagerFactory
that will be used to create theKafkaConsumerBackoffManager
instance used to back off the partitions.- Parameters:
registry
- theListenerContainerRegistry
used to fetch theMessageListenerContainer
.applicationContext
- the application context.- Returns:
- the instance.
-
internalRetryTopicClock
Return theClock
instance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-
createInternalRetryTopicClock
Create aClock
instance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-