org.apache.uima.adapter.jms.client
Class ActiveMQMessageSender

java.lang.Object
  extended by org.apache.uima.adapter.jms.client.BaseMessageSender
      extended by org.apache.uima.adapter.jms.client.ActiveMQMessageSender
All Implemented Interfaces:
java.lang.Runnable, MessageSender

public class ActiveMQMessageSender
extends BaseMessageSender

Initializes JMS session and creates JMS MessageProducer to be used for sending messages to a given destination. It extends BaseMessageSender which starts the worker thread and is tasked with sending messages. The application threads share a common 'queue' with the worker thread. The application threads add messages to the pendingMessageList 'queue' and the worker thread consumes them.


Field Summary
 
Fields inherited from class org.apache.uima.adapter.jms.client.BaseMessageSender
done, engine, exception, messageQueue, workerThreadFailed
 
Constructor Summary
ActiveMQMessageSender(javax.jms.Connection aConnection, java.lang.String aDestinationName, BaseUIMAAsynchronousEngineCommon_impl engine)
           
 
Method Summary
protected  void cleanup()
          Cleanup any jms resources used by the worker thread
 javax.jms.BytesMessage createBytesMessage()
           
 javax.jms.TextMessage createTextMessage()
           
protected  java.lang.String getDestinationEndpoint()
          Returns the full name of the destination queue
 javax.jms.MessageProducer getMessageProducer()
          Returns jsm MessageProducer
 javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
           
protected  void initializeProducer()
          Creates a jms session object used to instantiate message producer
 void setConnection(javax.jms.Connection aConnection)
          This is called when a new Connection is created after broker is restarted
 
Methods inherited from class org.apache.uima.adapter.jms.client.BaseMessageSender
doStop, failed, getReasonForFailure, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveMQMessageSender

public ActiveMQMessageSender(javax.jms.Connection aConnection,
                             java.lang.String aDestinationName,
                             BaseUIMAAsynchronousEngineCommon_impl engine)
                      throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getMessageProducer

public javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
                                             throws java.lang.Exception
Specified by:
getMessageProducer in interface MessageSender
Overrides:
getMessageProducer in class BaseMessageSender
Throws:
java.lang.Exception

setConnection

public void setConnection(javax.jms.Connection aConnection)
This is called when a new Connection is created after broker is restarted

Specified by:
setConnection in interface MessageSender
Specified by:
setConnection in class BaseMessageSender

initializeProducer

protected void initializeProducer()
                           throws java.lang.Exception
Creates a jms session object used to instantiate message producer

Specified by:
initializeProducer in class BaseMessageSender
Throws:
java.lang.Exception

getDestinationEndpoint

protected java.lang.String getDestinationEndpoint()
                                           throws java.lang.Exception
Returns the full name of the destination queue

Specified by:
getDestinationEndpoint in class BaseMessageSender
Throws:
java.lang.Exception

getMessageProducer

public javax.jms.MessageProducer getMessageProducer()
Returns jsm MessageProducer

Specified by:
getMessageProducer in interface MessageSender
Specified by:
getMessageProducer in class BaseMessageSender

createTextMessage

public javax.jms.TextMessage createTextMessage()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

createBytesMessage

public javax.jms.BytesMessage createBytesMessage()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

cleanup

protected void cleanup()
Cleanup any jms resources used by the worker thread

Specified by:
cleanup in class BaseMessageSender


Copyright © 2011. All Rights Reserved.