toolbox.services.jms.simple
Class SimpleProducerServiceImpl

Package class diagram package SimpleProducerServiceImpl
java.lang.Object
  extended by toolbox.services.BaseService
      extended by toolbox.services.jms.JmsService
          extended by toolbox.services.jms.simple.SimpleProducerServiceImpl
All Implemented Interfaces:
SimpleProducerService, Service

public class SimpleProducerServiceImpl
extends JmsService
implements SimpleProducerService

Default implementation of the SimpleProducerService interface.

This implementation can be configured into a Toolbox ServiceRegistry instance.


Constructor Summary
SimpleProducerServiceImpl()
          Default constructor.
 
Method Summary
 java.lang.String send(byte[] msg, java.lang.String producer, java.util.Map props)
          Send the given byte array using the named producer.
 java.lang.String send(byte[] msg, java.lang.String producer, java.lang.String correlation, java.util.Map props, javax.jms.Destination dest)
          Send the given byte array using the named producer.
 java.lang.String send(java.io.InputStream msg, java.lang.String producer, java.util.Map props)
          Send the content of the given stream using the named producer.
 java.lang.String send(java.io.InputStream msg, java.lang.String producer, java.lang.String correlation, java.util.Map props, javax.jms.Destination dest)
          Send the content of the given stream using the named producer.
 java.lang.String send(java.util.Map msg, java.lang.String producer, java.util.Map props)
          Send the given Map instance using the named producer.
 java.lang.String send(java.util.Map msg, java.lang.String producer, java.lang.String correlation, java.util.Map props, javax.jms.Destination dest)
          Send the given Map instance using the named producer.
 java.lang.String send(java.lang.Object msg, java.lang.String producer, java.util.Map props)
          Send the given Object instance using the named producer.
 java.lang.String send(java.lang.Object msg, java.lang.String producer, java.lang.String correlation, java.util.Map props, javax.jms.Destination dest)
          Send the given Object instance using the named producer.
 java.lang.String send(java.lang.String msg, java.lang.String producer, java.util.Map props)
          Send the given String using the named producer.
 java.lang.String send(java.lang.String msg, java.lang.String producer, java.lang.String correlation, java.util.Map props, javax.jms.Destination dest)
          Send the given String using the named producer and destination.
 void setDefaultMessageListener(javax.jms.MessageListener listener)
          Set the default MessageListener that this service must use to consume reply messages.
 void start(java.lang.String producer)
          Start the reply consumer of the named producer.
 
Methods inherited from class toolbox.services.jms.JmsService
create, destroy, getJmsConsumer, getJmsProducer
 
Methods inherited from class toolbox.services.BaseService
getConfigHome, getName, getProperties, getProperty, getXMLProperties, logConfig, logFine, logFiner, logFinest, logInfo, logSevere, logWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleProducerServiceImpl

public SimpleProducerServiceImpl()
Default constructor.

Method Detail

send

public java.lang.String send(java.lang.String msg,
                             java.lang.String producer,
                             java.lang.String correlation,
                             java.util.Map props,
                             javax.jms.Destination dest)
                      throws ServiceException
Send the given String using the named producer and destination.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - String containing the message content.
producer - String indicating the named producer that must to used to send the message.
correlation - String that must be used as the JMSCorrelationID.
props - Map instance containing simple message properties. Can be null.
dest - Target destination.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.lang.String msg,
                             java.lang.String producer,
                             java.util.Map props)
                      throws ServiceException
Send the given String using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - String containing the message content.
producer - String indicating the named producer that must to used to send the message.
props - Map instance containing simple message properties. Can be null.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(byte[] msg,
                             java.lang.String producer,
                             java.lang.String correlation,
                             java.util.Map props,
                             javax.jms.Destination dest)
                      throws ServiceException
Send the given byte array using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - A byte array containing the message content.
producer - String indicating the named producer that must to used to send the message.
correlation - String that must be used as the JMSCorrelationID.
props - Map instance containing simple message properties. Can be null.
dest - Target destination.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(byte[] msg,
                             java.lang.String producer,
                             java.util.Map props)
                      throws ServiceException
Send the given byte array using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - A byte array containing the message content.
producer - String indicating the named producer that must to used to send the message.
props - Map instance containing simple message properties. Can be null.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.io.InputStream msg,
                             java.lang.String producer,
                             java.lang.String correlation,
                             java.util.Map props,
                             javax.jms.Destination dest)
                      throws ServiceException
Send the content of the given stream using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - InputStream instance pointing to the message content.
producer - String indicating the named producer that must to used to send the message.
correlation - String that must be used as the JMSCorrelationID.
props - Map instance containing simple message properties. Can be null.
dest - Target destination.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.io.InputStream msg,
                             java.lang.String producer,
                             java.util.Map props)
                      throws ServiceException
Send the content of the given stream using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - InputStream instance pointing to the message content.
producer - String indicating the named producer that must to used to send the message.
props - Map instance containing simple message properties. Can be null.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.util.Map msg,
                             java.lang.String producer,
                             java.lang.String correlation,
                             java.util.Map props,
                             javax.jms.Destination dest)
                      throws ServiceException
Send the given Map instance using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - Map instance containing to the message content.
producer - String indicating the named producer that must to used to send the message.
correlation - String that must be used as the JMSCorrelationID.
props - Map instance containing simple message properties.
dest - Target destination.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.util.Map msg,
                             java.lang.String producer,
                             java.util.Map props)
                      throws ServiceException
Send the given Map instance using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - Map instance containing to the message content.
producer - String indicating the named producer that must to used to send the message.
props - Map instance containing simple message properties.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.lang.Object msg,
                             java.lang.String producer,
                             java.lang.String correlation,
                             java.util.Map props,
                             javax.jms.Destination dest)
                      throws ServiceException
Send the given Object instance using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - Object instance containing to the message content.
producer - String indicating the named producer that must to used to send the message.
correlation - String that must be used as the JMSCorrelationID.
props - Map instance containing simple message properties. Can be null.
dest - Target destination.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

send

public java.lang.String send(java.lang.Object msg,
                             java.lang.String producer,
                             java.util.Map props)
                      throws ServiceException
Send the given Object instance using the named producer.

Specified by:
send in interface SimpleProducerService
Parameters:
msg - Object instance containing to the message content.
producer - String indicating the named producer that must to used to send the message.
props - Map instance containing simple message properties. Can be null.
Returns:
String containing the message id of the sent message.
Throws:
ServiceException - if the message cannot be sent.

start

public void start(java.lang.String producer)
           throws ServiceException
Start the reply consumer of the named producer.

Specified by:
start in interface SimpleProducerService
Parameters:
producer - String indicating the named producer that must start listener for replies.
Throws:
ServiceException - if the producer cannot be started.

setDefaultMessageListener

public void setDefaultMessageListener(javax.jms.MessageListener listener)
Set the default MessageListener that this service must use to consume reply messages.

Specified by:
setDefaultMessageListener in interface SimpleProducerService
Parameters:
listener - MessageListener implementation.