org.exolab.jmscts.core
Class SessionHelper

java.lang.Object
  |
  +--org.exolab.jmscts.core.SessionHelper

public final class SessionHelper
extends java.lang.Object

Helper class for performing session operations

Version:
$Revision: 1.2 $ $Date: 2004/01/31 13:44:24 $
Author:
Tim Anderson

Method Summary
static javax.jms.MessageConsumer createConsumer(javax.jms.Session session, javax.jms.Destination destination, java.lang.String name)
          Create a message consumer for the supplied session and destination.
static javax.jms.MessageConsumer createConsumer(javax.jms.Session session, javax.jms.Destination destination, java.lang.String name, java.lang.String selector, boolean noLocal)
          Create a message consumer for the supplied session and destination and selector.
static javax.jms.MessageConsumer createConsumer(TestContext context, javax.jms.Destination destination, java.lang.String name)
          Create a message consumer for the supplied test context and destination
static javax.jms.MessageProducer createProducer(javax.jms.Session session, javax.jms.Destination destination)
          Create a message producer for the supplied test session and destination
static javax.jms.MessageProducer createProducer(TestContext context, javax.jms.Destination destination)
          Create a message producer for the supplied test context and destination
static MessageReceiver createReceiver(javax.jms.Session session, javax.jms.Destination destination, MessagingBehaviour behaviour)
          Create a MessageReceiver for the supplied session, destination, and messaging behaviour
static MessageReceiver createReceiver(javax.jms.Session session, javax.jms.Destination destination, MessagingBehaviour behaviour, java.lang.String selector, boolean noLocal)
          Create a MessageReceiver for the supplied session, destination, messaging behaviour, and selector
static MessageReceiver createReceiver(javax.jms.Session session, javax.jms.Destination destination, MessagingBehaviour behaviour, java.lang.String name, java.lang.String selector, boolean noLocal)
          Create a MessageReceiver for the supplied session, destination, messaging behaviour, and selector
static MessageReceiver createReceiver(TestContext context, javax.jms.Destination destination)
          Create a MessageReceiver for the supplied test context and destination
static MessageReceiver createReceiver(TestContext context, javax.jms.Destination destination, java.lang.String selector, boolean noLocal)
          Create a MessageReceiver for the supplied test context, destination, selector, and noLocal flag
static MessageReceiver createReceiver(TestContext context, javax.jms.Destination destination, java.lang.String name, java.lang.String selector, boolean noLocal)
          Create a MessageReceiver for the supplied test context, destination, name, selector, and noLocal flag
static MessageSender createSender(javax.jms.Session session, javax.jms.Destination destination, MessagingBehaviour behaviour)
          Create a MessageSender for the supplied session, destination and behaviour
static MessageSender createSender(TestContext context, javax.jms.Destination destination)
          Create a MessageSender for the supplied test context
static java.lang.String getSubscriberName()
          Return a unique name for a durable subscriber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createConsumer

public static javax.jms.MessageConsumer createConsumer(javax.jms.Session session,
                                                       javax.jms.Destination destination,
                                                       java.lang.String name)
                                                throws javax.jms.JMSException
Create a message consumer for the supplied session and destination. The name argument only applies to topic destinations.
Parameters:
session - the session
destination - the destination to consume messages from
name - if non-null, and the session is a TopicSession, then a durable subscriber will be returned, otherwise the argument is ignored.
Returns:
a new consumer
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createConsumer

public static javax.jms.MessageConsumer createConsumer(javax.jms.Session session,
                                                       javax.jms.Destination destination,
                                                       java.lang.String name,
                                                       java.lang.String selector,
                                                       boolean noLocal)
                                                throws javax.jms.JMSException
Create a message consumer for the supplied session and destination and selector. The name argument only applies to topic destinations.
Parameters:
session - the session
destination - the destination to consume messages from
name - if non-null, and the session is a TopicSession, then a durable subscriber will be returned, otherwise the argument is ignored.
selector - the message selector
noLocal - if the session is a TopicSession, then the subscriber will be created with the supplied noLocal flag, otherwise the argument is ignored.
Returns:
a new consumer
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createProducer

public static javax.jms.MessageProducer createProducer(javax.jms.Session session,
                                                       javax.jms.Destination destination)
                                                throws javax.jms.JMSException
Create a message producer for the supplied test session and destination
Parameters:
session - the test session
destination - the destination to send messages to
Returns:
a new producer
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createConsumer

public static javax.jms.MessageConsumer createConsumer(TestContext context,
                                                       javax.jms.Destination destination,
                                                       java.lang.String name)
                                                throws javax.jms.JMSException
Create a message consumer for the supplied test context and destination
Parameters:
context - the test context
destination - the destination to consume messages from
name - if non-null, and the session is a TopicSession, then a durable subscriber will be returned, otherwise the argument is ignored.
Returns:
a new consumer
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createProducer

public static javax.jms.MessageProducer createProducer(TestContext context,
                                                       javax.jms.Destination destination)
                                                throws javax.jms.JMSException
Create a message producer for the supplied test context and destination
Parameters:
context - the test context
destination - the destination to send messages to
Returns:
a new producer
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(javax.jms.Session session,
                                             javax.jms.Destination destination,
                                             MessagingBehaviour behaviour)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied session, destination, and messaging behaviour
Parameters:
session - the session
destination - the destination to consume messages from
behaviour - the messaging behaviour
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(javax.jms.Session session,
                                             javax.jms.Destination destination,
                                             MessagingBehaviour behaviour,
                                             java.lang.String selector,
                                             boolean noLocal)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied session, destination, messaging behaviour, and selector
Parameters:
session - the session
destination - the destination to consume messages from
behaviour - the messaging behaviour
selector - the message selector
noLocal - if the session is a TopicSession, then the subscriber will be created with the supplied noLocal flag, otherwise the argument is ignored.
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(javax.jms.Session session,
                                             javax.jms.Destination destination,
                                             MessagingBehaviour behaviour,
                                             java.lang.String name,
                                             java.lang.String selector,
                                             boolean noLocal)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied session, destination, messaging behaviour, and selector
Parameters:
session - the session
destination - the destination to consume messages from
behaviour - the messaging behaviour
name - if non-null, and the session is a TopicSession, then a durable subscriber will be returned, otherwise the argument is ignored. If null, and the session is a TopicSession and the behaviour is for durable subscribers, then a name will be automatically allocated.
selector - the message selector
noLocal - if the session is a TopicSession, then the subscriber will be created with the supplied noLocal flag, otherwise the argument is ignored.
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(TestContext context,
                                             javax.jms.Destination destination)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied test context and destination
Parameters:
context - the test context
destination - the destination to consume messages from
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(TestContext context,
                                             javax.jms.Destination destination,
                                             java.lang.String selector,
                                             boolean noLocal)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied test context, destination, selector, and noLocal flag
Parameters:
context - the test context
destination - the destination to consume messages from
selector - the message selector
noLocal - if the session is a TopicSession, then the subscriber will be created with the supplied noLocal flag, otherwise the argument is ignored.
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createReceiver

public static MessageReceiver createReceiver(TestContext context,
                                             javax.jms.Destination destination,
                                             java.lang.String name,
                                             java.lang.String selector,
                                             boolean noLocal)
                                      throws javax.jms.JMSException
Create a MessageReceiver for the supplied test context, destination, name, selector, and noLocal flag
Parameters:
context - the test context
destination - the destination to consume messages from
name - if non-null, and the session is a TopicSession, then a durable subscriber will be returned, otherwise the argument is ignored. If null, and the session is a TopicSession and the behaviour is for durable subscribers, then a name will be automatically allocated.
selector - the message selector
noLocal - if the session is a TopicSession, then the subscriber will be created with the supplied noLocal flag, otherwise the argument is ignored.
Returns:
a new message receiver
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createSender

public static MessageSender createSender(javax.jms.Session session,
                                         javax.jms.Destination destination,
                                         MessagingBehaviour behaviour)
                                  throws javax.jms.JMSException
Create a MessageSender for the supplied session, destination and behaviour
Parameters:
session - the sesssion
destination - the destination to send messages to
behaviour - the messaging behaviour
Returns:
a new message sender
Throws:
javax.jms.JMSException - if any of the JMS operations fail

createSender

public static MessageSender createSender(TestContext context,
                                         javax.jms.Destination destination)
                                  throws javax.jms.JMSException
Create a MessageSender for the supplied test context
Parameters:
context - the test context
destination - the destination to send messages to
Returns:
a new message sender
Throws:
javax.jms.JMSException - if any of the JMS operations fail

getSubscriberName

public static java.lang.String getSubscriberName()
Return a unique name for a durable subscriber
Returns:
a unique name


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.