toolbox.jms
Interface JmsConsumer

Package class diagram package JmsConsumer
All Known Implementing Classes:
JmsConsumerImpl

public interface JmsConsumer

Interface defining a generic JMS consumer. Implementations of this interface must provide Queue receiver and Topic subscriber functionalities.


Method Summary
 void destroy()
          Destroy this consumer.
 java.lang.String getName()
          Return the name of 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.
 

Method Detail

init

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.

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

getName

java.lang.String getName()
Return the name of this consumer.

Returns:
String containing the name of this consumer.

start

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

Throws:
JmsException

stop

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

Throws:
JmsException

setMessageListener

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.

Parameters:
listener - MessageListener implementation that must be used to process messages.

receive

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.

Returns:
Message that was received.
Throws:
JmsException - if the message could not be consumed.

destroy

void destroy()
Destroy this consumer.