Novell exteNd Messaging Platform 5.2

com.sssw.jms.api
Class JMQMessageBean

java.lang.Object
  extended bycom.sssw.jms.api.JMQMessageBean
All Implemented Interfaces:
MessageListener

public abstract class JMQMessageBean
extends Object
implements MessageListener

A utility class for easy creation of message consumers. This class supports a variety of constructors that automatically initializes the connection, session, and consumer for messaging. Developers can extend this class and just provide an implementation of the onMessage method.

Since:
jBroker MQ 2.0

Constructor Summary
JMQMessageBean(Connection connection, Destination destination)
          This constructor creates a message bean, which is connected to destination: If destination is a queue, the constructor creates a queue connection, a queue session, and a queue receiver on which this object is set as the message listener.
JMQMessageBean(Connection connection, Destination destination, String selector)
          This constructor creates a message bean, which is connected to destination: If destination is a queue, the constructor creates a queue connection, a queue session, and a queue receiver on which this object is set as the message listener.
JMQMessageBean(ConnectionFactory factory, Destination destination)
          This constructor creates a message bean, which is connected to destination: If destination is a queue, the constructor creates a queue connection, a queue session, and a queue receiver on which this object is set as the message listener.
JMQMessageBean(ConnectionFactory factory, Destination destination, String selector)
          This constructor creates a message bean, which is connected to destination: If destination is a queue, the constructor creates a queue connection, a queue session, and a queue receiver on which this object is set as the message listener.
 
Method Summary
 void close()
          Close the underlying message consumer.
 Connection getConnection()
          Returns the connection created by this message bean.
 ConnectionFactory getConnectionFactory()
          Returns the connection factory created by this message bean.
 MessageConsumer getConsumer()
          Returns the message consumer created by this message bean.
 String getSelector()
          Returns the selector set on message consumer, or null if no selector was specified.
 Session getSession()
          Returns the session created by this message bean.
 void run()
          Block until the calling thread is interrupted.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jms.MessageListener
onMessage
 

Constructor Detail

JMQMessageBean

public JMQMessageBean(ConnectionFactory factory,
                      Destination destination)
               throws JMSException
This constructor creates a message bean, which is connected to destination: The session is created with AUTO_ACKNOWLEDGE.

Parameters:
factory - the factory to use when creating the consumer
destination - the destination where consumer will be connected
Throws:
JMSException - if connecting consumer failed
See Also:
JMQMessageBean(ConnectionFactory,Destination,String)

JMQMessageBean

public JMQMessageBean(ConnectionFactory factory,
                      Destination destination,
                      String selector)
               throws JMSException
This constructor creates a message bean, which is connected to destination: The session is created with AUTO_ACKNOWLEDGE.

Parameters:
factory - the factory to use when creating the consumer
destination - the destination where consumer will be connected
selector - the selector set on the consumer
Throws:
JMSException - if connecting consumer failed
See Also:
JMQMessageBean(Connection,Destination,String)

JMQMessageBean

public JMQMessageBean(Connection connection,
                      Destination destination)
               throws JMSException
This constructor creates a message bean, which is connected to destination: The session is created with AUTO_ACKNOWLEDGE.

Parameters:
connection - the connection to use when creating the consumer
destination - the destination where consumer will be connected
Throws:
JMSException - if connecting consumer failed
See Also:
JMQMessageBean(Connection,Destination,String)

JMQMessageBean

public JMQMessageBean(Connection connection,
                      Destination destination,
                      String selector)
               throws JMSException
This constructor creates a message bean, which is connected to destination: The session is created with AUTO_ACKNOWLEDGE.

Parameters:
connection - the connection to use when creating the consumer
destination - the destination where consumer will be connected
selector - the selector set on the consumer
Throws:
JMSException - if connecting consumer failed
Method Detail

getConnectionFactory

public ConnectionFactory getConnectionFactory()
Returns the connection factory created by this message bean. Depending on the type of bean, the returned object can be cast to one of the following:

Returns:
the connection factory used by this bean.

getConnection

public Connection getConnection()
Returns the connection created by this message bean. Depending on the type of bean, the returned object can be cast to one of the following:

Returns:
the connection used by this bean.

getSession

public Session getSession()
Returns the session created by this message bean. Depending on the type of bean, the returned object can be cast to one of the following:

Returns:
the session used by this bean.

getConsumer

public MessageConsumer getConsumer()
Returns the message consumer created by this message bean. Depending on the type of bean, the returned object can be cast to one of the following:

Returns:
the consumer used by this bean.

getSelector

public String getSelector()
Returns the selector set on message consumer, or null if no selector was specified.

Returns:
the selector string

run

public void run()
Block until the calling thread is interrupted. This is not a busy wait loop since the wait method is simpy called.


close

public void close()
           throws JMSException
Close the underlying message consumer. If a thread is blocked by the run method it will be unblocked.

Throws:
JMSException - if the underlying consumer could not be closed
Since:
Novell exteNd Messaging Platform 5.1

toString

public String toString()

Novell exteNd Messaging Platform 5.2

exteNd is a registered trademark of Novell, Inc.
Copyright 1998-2004 Novell, Inc. All Rights Reserved.