Class DefaultDestinationTopicResolver
java.lang.Object
org.springframework.kafka.listener.KafkaExceptionLogLevelAware
org.springframework.kafka.listener.ExceptionClassifier
org.springframework.kafka.retrytopic.DefaultDestinationTopicResolver
- All Implemented Interfaces:
EventListener,org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>,DestinationTopicContainer,DestinationTopicResolver
public class DefaultDestinationTopicResolver
extends ExceptionClassifier
implements DestinationTopicResolver, org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
Default implementation of the DestinationTopicResolver interface.
The container is closed when a
ContextRefreshedEvent is received
and no more destinations can be added after that.- Since:
- 2.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionDefaultDestinationTopicResolver(Clock clock, org.springframework.context.ApplicationContext applicationContext) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDestinationTopics(List<DestinationTopic> destinationsToAdd) Adds the provided destination topics to the container.getDestinationTopicByName(String topic) Returns the DestinationTopic instance registered for that topic.booleanReturn true if the application context is refreshed.voidonApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) resolveDestinationTopic(String topic, Integer attempt, Exception e, long originalTimestamp) Resolves the destination topic for the failed message.Methods inherited from class org.springframework.kafka.listener.ExceptionClassifier
addNotRetryableExceptions, getClassifier, removeNotRetryableException, setClassificationsMethods inherited from class org.springframework.kafka.listener.KafkaExceptionLogLevelAware
getLogLevel, setLogLevel
-
Constructor Details
-
DefaultDestinationTopicResolver
public DefaultDestinationTopicResolver(Clock clock, org.springframework.context.ApplicationContext applicationContext)
-
-
Method Details
-
resolveDestinationTopic
public DestinationTopic resolveDestinationTopic(String topic, Integer attempt, Exception e, long originalTimestamp) Description copied from interface:DestinationTopicResolverResolves the destination topic for the failed message.- Specified by:
resolveDestinationTopicin interfaceDestinationTopicResolver- Parameters:
topic- the current topic for the message.attempt- the number of processing attempts already made for that message.e- the exception the message processing has thrownoriginalTimestamp- the time when the first attempt to process the message threw an exception.- Returns:
- the
DestinationTopicfor the given parameters.
-
getDestinationTopicByName
Description copied from interface:DestinationTopicContainerReturns the DestinationTopic instance registered for that topic.- Specified by:
getDestinationTopicByNamein interfaceDestinationTopicContainer- Parameters:
topic- the topic name of the DestinationTopic to be returned.- Returns:
- the DestinationTopic instance registered for that topic.
-
addDestinationTopics
Description copied from interface:DestinationTopicContainerAdds the provided destination topics to the container.- Specified by:
addDestinationTopicsin interfaceDestinationTopicContainer- Parameters:
destinationsToAdd- theDestinationTopiclist to add.
-
onApplicationEvent
public void onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
-
isContextRefreshed
public boolean isContextRefreshed()Return true if the application context is refreshed.- Returns:
- true if refreshed.
- Since:
- 2.7.8
-