Class RetryTopicComponentFactory
- java.lang.Object
-
- org.springframework.kafka.retrytopic.RetryTopicComponentFactory
-
public class RetryTopicComponentFactory extends java.lang.ObjectProvide 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.ClockcreateInternalRetryTopicClock()Create aClockinstance that will be used for all time-related operations in the retry topic processes.DeadLetterPublishingRecovererFactorydeadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver)Create theDeadLetterPublishingRecovererFactorythat will be used to create theDeadLetterPublishingRecovererto forward the records to a givenDestinationTopic.DestinationTopicProcessordestinationTopicProcessor(DestinationTopicResolver destinationTopicResolver)Create theDestinationTopicProcessorthat will be used to process theDestinationTopicinstances and store them in the providedDestinationTopicResolver.DestinationTopicResolverdestinationTopicResolver()Create the instance ofDestinationTopicResolverthat will be used to store theDestinationTopicinstance and resolve which a given record should be forwarded to.java.time.ClockinternalRetryTopicClock()Return theClockinstance that will be used for all time-related operations in the retry topic processes.KafkaBackOffManagerFactorykafkaBackOffManagerFactory(ListenerContainerRegistry registry, org.springframework.context.ApplicationContext applicationContext)Create theKafkaBackOffManagerFactorythat will be used to create theKafkaConsumerBackoffManagerinstance used to back off the partitions.ListenerContainerFactoryConfigurerlistenerContainerFactoryConfigurer(KafkaConsumerBackoffManager kafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory, java.time.Clock clock)Create aListenerContainerFactoryConfigurerthat will be used to configure theKafkaListenerContainerFactoryresolved by theListenerContainerFactoryResolver.ListenerContainerFactoryResolverlistenerContainerFactoryResolver(org.springframework.beans.factory.BeanFactory beanFactory)Create theListenerContainerFactoryResolverthat will be used to resolve the appropriateKafkaListenerContainerFactoryfor a given topic.RetryTopicConfigurerretryTopicConfigurer(DestinationTopicProcessor destinationTopicProcessor, ListenerContainerFactoryConfigurer listenerContainerFactoryConfigurer, ListenerContainerFactoryResolver factoryResolver, RetryTopicNamesProviderFactory retryTopicNamesProviderFactory)Create theRetryTopicConfigurerthat will serve as an entry point for configuring non-blocking topic-based delayed retries for a givenKafkaListenerEndpoint, by processing the appropriateRetryTopicConfiguration.RetryTopicNamesProviderFactoryretryTopicNamesProviderFactory()Create theRetryTopicNamesProviderFactoryinstance 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 theRetryTopicConfigurerthat will serve as an entry point for configuring non-blocking topic-based delayed retries for a givenKafkaListenerEndpoint, by processing the appropriateRetryTopicConfiguration.- Parameters:
destinationTopicProcessor- theDestinationTopicProcessorthat will be used to process theDestinationTopicinstances and register them in aDestinationTopicContainer.listenerContainerFactoryConfigurer- theListenerContainerFactoryConfigurerthat will be used to configure theKafkaListenerContainerFactoryinstances for the non-blocking delayed retries feature.factoryResolver- theListenerContainerFactoryResolverthat will be used to resolve the properKafkaListenerContainerFactoryfor a given endpoint or its retry topics.retryTopicNamesProviderFactory- theRetryTopicNamesProviderFactorythat will be used to provide the property names for the retry topics' endpoints.- Returns:
- the instance.
-
destinationTopicProcessor
public DestinationTopicProcessor destinationTopicProcessor(DestinationTopicResolver destinationTopicResolver)
Create theDestinationTopicProcessorthat will be used to process theDestinationTopicinstances and store them in the providedDestinationTopicResolver.- Parameters:
destinationTopicResolver- theDestinationTopicResolverinstance to be used to store theDestinationTopicinstances.- Returns:
- the instance.
-
destinationTopicResolver
public DestinationTopicResolver destinationTopicResolver()
Create the instance ofDestinationTopicResolverthat will be used to store theDestinationTopicinstance and resolve which a given record should be forwarded to.- Returns:
- the instance.
-
deadLetterPublishingRecovererFactory
public DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory(DestinationTopicResolver destinationTopicResolver)
Create theDeadLetterPublishingRecovererFactorythat will be used to create theDeadLetterPublishingRecovererto forward the records to a givenDestinationTopic.- Parameters:
destinationTopicResolver- theDestinationTopicResolverinstance to resolve the destinations.- Returns:
- the instance.
-
listenerContainerFactoryResolver
public ListenerContainerFactoryResolver listenerContainerFactoryResolver(org.springframework.beans.factory.BeanFactory beanFactory)
Create theListenerContainerFactoryResolverthat will be used to resolve the appropriateKafkaListenerContainerFactoryfor a given topic.- Parameters:
beanFactory- theBeanFactorythat will be used to retrieve theKafkaListenerContainerFactoryinstance if necessary.- Returns:
- the instance.
-
listenerContainerFactoryConfigurer
public ListenerContainerFactoryConfigurer listenerContainerFactoryConfigurer(KafkaConsumerBackoffManager kafkaConsumerBackoffManager, DeadLetterPublishingRecovererFactory deadLetterPublishingRecovererFactory, java.time.Clock clock)
Create aListenerContainerFactoryConfigurerthat will be used to configure theKafkaListenerContainerFactoryresolved by theListenerContainerFactoryResolver.- Parameters:
kafkaConsumerBackoffManager- theKafkaConsumerBackoffManagerused with theKafkaBackoffAwareMessageListenerAdapter.deadLetterPublishingRecovererFactory- the factory that will provide theDeadLetterPublishingRecovererinstance to be used.clock- theClockinstance to be used with the listener adapter.- Returns:
- the instance.
-
retryTopicNamesProviderFactory
public RetryTopicNamesProviderFactory retryTopicNamesProviderFactory()
Create theRetryTopicNamesProviderFactoryinstance 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 theKafkaBackOffManagerFactorythat will be used to create theKafkaConsumerBackoffManagerinstance used to back off the partitions.- Parameters:
registry- theListenerContainerRegistryused to fetch theMessageListenerContainer.applicationContext- the application context.- Returns:
- the instance.
-
internalRetryTopicClock
public java.time.Clock internalRetryTopicClock()
Return theClockinstance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-
createInternalRetryTopicClock
protected java.time.Clock createInternalRetryTopicClock()
Create aClockinstance that will be used for all time-related operations in the retry topic processes.- Returns:
- the instance.
-
-