Class SimpleDestinationResolver

java.lang.Object
org.springframework.jms.support.destination.DynamicDestinationResolver
org.springframework.jms.support.destination.SimpleDestinationResolver
All Implemented Interfaces:
CachingDestinationResolver, DestinationResolver

public class SimpleDestinationResolver extends DynamicDestinationResolver implements CachingDestinationResolver
A simple DestinationResolver implementation for Session-based destination resolution, caching Queue and Topic instances per queue/topic name. In that sense, the destinations themselves also need to be "simple": not Session-specific and therefore stable across an entire JMS setup.

This is the default resolver used by JmsClient and also JmsTemplate and listener containers, as of 7.0. For enforcing fresh resolution on every call, you may explicitly set a DynamicDestinationResolver instead.

Since:
7.0
Author:
Juergen Hoeller
See Also:
  • Constructor Details

    • SimpleDestinationResolver

      public SimpleDestinationResolver()
  • Method Details

    • resolveTopic

      protected jakarta.jms.Topic resolveTopic(jakarta.jms.Session session, String topicName) throws jakarta.jms.JMSException
      Description copied from class: DynamicDestinationResolver
      Resolve the given destination name to a Topic.
      Overrides:
      resolveTopic in class DynamicDestinationResolver
      Parameters:
      session - the current JMS Session
      topicName - the name of the desired Topic
      Returns:
      the JMS Topic
      Throws:
      jakarta.jms.JMSException - if resolution failed
      See Also:
      • Session.createTopic(String)
    • resolveQueue

      protected jakarta.jms.Queue resolveQueue(jakarta.jms.Session session, String queueName) throws jakarta.jms.JMSException
      Description copied from class: DynamicDestinationResolver
      Resolve the given destination name to a Queue.
      Overrides:
      resolveQueue in class DynamicDestinationResolver
      Parameters:
      session - the current JMS Session
      queueName - the name of the desired Queue
      Returns:
      the JMS Queue
      Throws:
      jakarta.jms.JMSException - if resolution failed
      See Also:
      • Session.createQueue(String)
    • removeFromCache

      public void removeFromCache(String destinationName)
      Description copied from interface: CachingDestinationResolver
      Remove the destination with the given name from the cache (if cached by this resolver in the first place).

      To be called if access to the specified destination failed, assuming that the JMS Destination object might have become invalid.

      Specified by:
      removeFromCache in interface CachingDestinationResolver
      Parameters:
      destinationName - the name of the destination
    • clearCache

      public void clearCache()
      Description copied from interface: CachingDestinationResolver
      Clear the entire destination cache.

      To be called in case of general JMS provider failure.

      Specified by:
      clearCache in interface CachingDestinationResolver