Class DefaultDestinationTopicResolver

  • All Implemented Interfaces:
    java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, 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>, org.springframework.context.ApplicationContextAware
    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
    • Constructor Detail

      • DefaultDestinationTopicResolver

        @Deprecated
        public DefaultDestinationTopicResolver​(java.time.Clock clock,
                                               org.springframework.context.ApplicationContext applicationContext)
        Deprecated.
      • DefaultDestinationTopicResolver

        public DefaultDestinationTopicResolver​(java.time.Clock clock)
        Constructs an instance with the given clock.
        Parameters:
        clock - the clock to be used for time-based operations such as verifying timeouts.
        Since:
        2.9
      • DefaultDestinationTopicResolver

        public DefaultDestinationTopicResolver()
        Constructs an instance with a default clock.
        Since:
        2.9
    • Method Detail

      • resolveDestinationTopic

        public DestinationTopic resolveDestinationTopic​(java.lang.String topic,
                                                        java.lang.Integer attempt,
                                                        java.lang.Exception e,
                                                        long originalTimestamp)
        Description copied from interface: DestinationTopicResolver
        Resolves the destination topic for the failed message.
        Specified by:
        resolveDestinationTopic in interface DestinationTopicResolver
        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 thrown
        originalTimestamp - the time when the first attempt to process the message threw an exception.
        Returns:
        the DestinationTopic for the given parameters.
      • onApplicationEvent

        public void onApplicationEvent​(org.springframework.context.event.ContextRefreshedEvent event)
        Specified by:
        onApplicationEvent in interface org.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
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        Specified by:
        setApplicationContext in interface org.springframework.context.ApplicationContextAware
        Throws:
        org.springframework.beans.BeansException