toolbox.jms
Interface JmsProducer

Package class diagram package JmsProducer
All Known Implementing Classes:
JmsProducerImpl

public interface JmsProducer

Interface defining a generic JMS producer.


Method Summary
 javax.jms.Message createMessage(int type)
          Create a message of the specified type.
 void destroy()
          Destroy this producer.
 java.lang.String getName()
          Return the name of this producer.
 void init(java.lang.String name, java.util.Map props, javax.jms.ExceptionListener exLsnr)
          Initialise this producer with the given name identifier and configuration properties.
 java.lang.String send(javax.jms.Message msg)
          Send the given message using this producer.
 java.lang.String send(javax.jms.Message msg, javax.jms.Destination destination)
          Send the given message using this producer.
 void setMessageListener(javax.jms.MessageListener listener)
          If this producer is of type point_to_point use this MessageListener to receive replies.
 void start()
          Tell this producer to start listening for replies.
 void stop()
          Tell this producer to stop listening for replies.
 

Method Detail

init

void init(java.lang.String name,
          java.util.Map props,
          javax.jms.ExceptionListener exLsnr)
          throws JmsException
Initialise this producer with the given name identifier and configuration properties.

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

getName

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

Returns:
String containing the name of this producer.

createMessage

javax.jms.Message createMessage(int type)
                                throws JmsException
Create a message of the specified type.

Parameters:
type - int indicating the type of message. Refer to JmsConstants.
Returns:
Message instance.
Throws:
JmsException - if the message cannot be created.

send

java.lang.String send(javax.jms.Message msg)
                      throws JmsException
Send the given message using this producer. If this producer is of type point_to_point it will be sent to a queue and published to a topic if the producer is of type publish_subscribe.

Parameters:
msg - Message instance to send.
Returns:
The message id of the sent message.
Throws:
JmsException - if the message cannot be sent.

send

java.lang.String send(javax.jms.Message msg,
                      javax.jms.Destination destination)
                      throws JmsException
Send the given message using this producer. If this producer is of type point_to_point it will be sent to a queue and published to a topic if the producer is of type publish_subscribe.

Parameters:
msg - Message instance to send.
destination - Use this destination as the target queue or topic.
Returns:
The message id of the sent message.
Throws:
JmsException - if the message cannot be sent.

setMessageListener

void setMessageListener(javax.jms.MessageListener listener)
If this producer is of type point_to_point use this MessageListener to receive replies.

Parameters:
listener - MessageListener that must be used.

start

void start()
           throws JmsException
Tell this producer to start listening for replies.

Throws:
JmsException

stop

void stop()
          throws JmsException
Tell this producer to stop listening for replies.

Throws:
JmsException

destroy

void destroy()
Destroy this producer.