toolbox.jms
Class JmsConsumerImpl

Package class diagram package JmsConsumerImpl
java.lang.Object
  extended by toolbox.jms.JmsObject
      extended by toolbox.jms.JmsConsumerImpl
All Implemented Interfaces:
JmsConsumer

public class JmsConsumerImpl
extends JmsObject
implements JmsConsumer

Default JmsConsumer implementation. This implementation provides Queue receiver and Topic subscriber functionalities.


Field Summary
 
Fields inherited from class toolbox.jms.JmsObject
m_exposeContext, m_jndiConfig
 
Constructor Summary
JmsConsumerImpl()
          Default constructor.
 
Method Summary
 void destroy()
          Destroy this consumer.
 void init(java.lang.String name, java.util.Map props, javax.jms.ExceptionListener exLsnr)
          Initialise this consumer with the given name identifier and configuration properties.
 javax.jms.Message receive()
          Use this method to receive messages when no listener was specified for this consumer in point_to_point mode.
 void setMessageListener(javax.jms.MessageListener listener)
          Set the message listener that must be used by this consumer to process messages.
 void start()
          Tell this consumer to start listening.
 void stop()
          Tell this consumer to stop listening.
 
Methods inherited from class toolbox.jms.JmsObject
destroyObject, getConnection, getDestination, getName, getSession, getType, initObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface toolbox.jms.JmsConsumer
getName
 

Constructor Detail

JmsConsumerImpl

public JmsConsumerImpl()
Default constructor.

Method Detail

init

public void init(java.lang.String name,
                 java.util.Map props,
                 javax.jms.ExceptionListener exLsnr)
          throws JmsException
Initialise this consumer with the given name identifier and configuration properties. This consumer implementation supports the following properties in the given props map:

Specified by:
init in interface JmsConsumer
Parameters:
name - String containing the name identifier of this consumer.
props - Map instance containing the configuration for this consumer.
exLsnr - ExceptionListener instance that this producer must use to monitor it's broker connection.
Throws:
JmsException - if the consumer cannot be initialised.

start

public void start()
           throws JmsException
Tell this consumer to start listening.

Specified by:
start in interface JmsConsumer
Throws:
JmsException

stop

public void stop()
          throws JmsException
Tell this consumer to stop listening.

Specified by:
stop in interface JmsConsumer
Throws:
JmsException

setMessageListener

public void setMessageListener(javax.jms.MessageListener listener)
Set the message listener that must be used by this consumer to process messages. This method is useful when initialising JMS components inside a Java enterprise container.

Specified by:
setMessageListener in interface JmsConsumer
Parameters:
listener - MessageListener implementation that must be used to process messages.

receive

public javax.jms.Message receive()
                          throws JmsException
Use this method to receive messages when no listener was specified for this consumer in point_to_point mode.

Specified by:
receive in interface JmsConsumer
Returns:
Message that was received.
Throws:
JmsException - if the message could not be consumed.

destroy

public void destroy()
Destroy this consumer.

Specified by:
destroy in interface JmsConsumer