Class RetryTopicComponentFactory
- java.lang.Object
-
- org.springframework.kafka.retrytopic.RetryTopicComponentFactory
-
public class RetryTopicComponentFactory extends java.lang.Object
Provide the component instances that will be used withRetryTopicConfigurationSupport
. Override any of the methods to provide a different implementation or subclass, then override theRetryTopicConfigurationSupport.createComponentFactory()
method to return this factory's subclass.- Since:
- 2.9
- Author:
- Tomaz Fernandes
-
-
Constructor Summary
Constructors Constructor Description RetryTopicComponentFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.time.Clock
createInternalRetryTopicClock()
Create aClock
instance that will be used for all time-related operations in the retry topic processes.DeadLetterPublishingRecovererFactory
deadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver)
Create theDeadLetterPublishingRecovererFactory
that will be used to create theDeadLetterPublishingRecoverer
to forward the records to a givenDestinationTopic
.DestinationTopicProcessor
destinationTopicProcessor(DestinationTopicResolver destinationTopicResolver)
Create theDestinationTopicProcessor
that will be used to process theDestinationTopic
instances and store them in the providedDestinationTopicResolver
.DestinationTopicResolver
destinationTopicResolver()
Create the instance ofDestinationTopicResolver
that will be used to store theDestinationTopic
instance and resolve which a given record should be forwarded to.java.time.Clock
internalRetryTopicClock()
Return theClock
instance that will be used for all time-related operations in the retry topic processes.KafkaBackOffManagerFactory
kafkaBackOffManagerFactory(ListenerContainerRegistry registry, org.springframework.context.ApplicationContext applicationContext)
Create theKafkaBackOffManagerFactory
that will be used to create theKafkaConsumerBackoffManager
instance used to back off the partitions.ListenerContainerFactoryConfigurer
listenerContainerFactoryConfigurer(KafkaConsumerBackoffManager kafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory, java.time.Clock clock)
Create aListenerContainerFactoryConfigurer
that will be used to configure theKafkaListenerContainerFactory
resolved by theListenerContainerFactoryResolver
.ListenerContainerFactoryResolver
listenerContainerFactoryResolver(org.springframework.beans.factory.BeanFactory beanFactory)
Create theListenerContainerFactoryResolver
that will be used to resolve the appropriateKafkaListenerContainerFactory
for a given topic.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
.RetryTopicNamesProviderFactory
retryTopicNamesProviderFactory()
Create theRetryTopicNamesProviderFactory
instance that will be used to provide the property names for the retry topics'KafkaListenerEndpoint
.
-
-
-
Method Detail
-
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
public DestinationTopicResolver 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
public ListenerContainerFactoryResolver listenerContainerFactoryResolver(org.springframework.beans.factory.BeanFactory beanFactory)
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, java.time.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
public RetryTopicNamesProviderFactory 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(ListenerContainerRegistry registry, org.springframework.context.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
public java.time.Clock internalRetryTopicClock()
Return theClock
instance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-
createInternalRetryTopicClock
protected java.time.Clock createInternalRetryTopicClock()
Create aClock
instance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-
-