org.springframework.jms.support.destination

Class JndiDestinationResolver

    • Constructor Detail

      • JndiDestinationResolver

        public JndiDestinationResolver()
    • Method Detail

      • setCache

        public void setCache(boolean cache)
        Set whether to cache resolved destinations. Default is "true".

        This flag can be turned off to re-lookup a destination for each operation, which allows for hot restarting of destinations. This is mainly useful during development.

        Note that dynamic queues and topics get cached by destination name. As a consequence, you need to use unique destination names across both queues and topics.

      • resolveDestinationName

        public Destination resolveDestinationName(@Nullable
                                                  Session session,
                                                  java.lang.String destinationName,
                                                  boolean pubSubDomain)
                                           throws JMSException
        Description copied from interface: DestinationResolver
        Resolve the given destination name, either as located resource or as dynamic destination.
        Specified by:
        resolveDestinationName in interface DestinationResolver
        Parameters:
        session - the current JMS Session (may be null if the resolver implementation is able to work without it)
        destinationName - the name of the destination
        pubSubDomain - true if the domain is pub-sub, false if P2P
        Returns:
        the JMS destination (either a topic or a queue)
        Throws:
        JMSException - if the JMS Session failed to resolve the destination
      • validateDestination

        protected void validateDestination(Destination destination,
                                           java.lang.String destinationName,
                                           boolean pubSubDomain)
        Validate the given Destination object, checking whether it matches the expected type.
        Parameters:
        destination - the Destination object to validate
        destinationName - the name of the destination
        pubSubDomain - true if a Topic is expected, false in case of a Queue
      • removeFromCache

        public void removeFromCache(java.lang.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