Spring Framework

org.springframework.jms.support.destination
Class DynamicDestinationResolver

java.lang.Object
  extended by org.springframework.jms.support.destination.DynamicDestinationResolver
All Implemented Interfaces:
DestinationResolver

public class DynamicDestinationResolver
extends java.lang.Object
implements DestinationResolver

Simple DestinationResolver implementation resolving destination names as dynamic destinations.

This implementation will work on both JMS 1.1 and JMS 1.0.2, because it uses the QueueSession or TopicSession methods if possible, falling back to JMS 1.1's generic Session methods.

Since:
1.1
Author:
Juergen Hoeller
See Also:
QueueSession.createQueue(java.lang.String), TopicSession.createTopic(java.lang.String), Session.createQueue(java.lang.String), Session.createTopic(java.lang.String)

Constructor Summary
DynamicDestinationResolver()
           
 
Method Summary
 javax.jms.Destination resolveDestinationName(javax.jms.Session session, java.lang.String destinationName, boolean pubSubDomain)
          Resolve the specified destination name as a dynamic destination.
protected  javax.jms.Queue resolveQueue(javax.jms.Session session, java.lang.String queueName)
          Resolve the given destination name to a Queue.
protected  javax.jms.Topic resolveTopic(javax.jms.Session session, java.lang.String topicName)
          Resolve the given destination name to a Topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicDestinationResolver

public DynamicDestinationResolver()
Method Detail

resolveDestinationName

public javax.jms.Destination resolveDestinationName(javax.jms.Session session,
                                                    java.lang.String destinationName,
                                                    boolean pubSubDomain)
                                             throws javax.jms.JMSException
Resolve the specified destination name as a dynamic destination.

Specified by:
resolveDestinationName in interface DestinationResolver
Parameters:
session - the current JMS Session
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:
javax.jms.JMSException - if resolution failed
See Also:
resolveTopic(javax.jms.Session, String), resolveQueue(javax.jms.Session, String)

resolveTopic

protected javax.jms.Topic resolveTopic(javax.jms.Session session,
                                       java.lang.String topicName)
                                throws javax.jms.JMSException
Resolve the given destination name to a Topic.

Parameters:
session - the current JMS Session
topicName - the name of the desired Topic
Returns:
the JMS Topic
Throws:
javax.jms.JMSException - if resolution failed
See Also:
Session.createTopic(String)

resolveQueue

protected javax.jms.Queue resolveQueue(javax.jms.Session session,
                                       java.lang.String queueName)
                                throws javax.jms.JMSException
Resolve the given destination name to a Queue.

Parameters:
session - the current JMS Session
queueName - the name of the desired Queue
Returns:
the JMS Queue
Throws:
javax.jms.JMSException - if resolution failed
See Also:
Session.createQueue(String)

Spring Framework