Class ActiveMQMessageSender
- java.lang.Object
-
- org.apache.uima.adapter.jms.client.BaseMessageSender
-
- 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
Constructors Constructor Description ActiveMQMessageSender(javax.jms.Connection aConnection, java.lang.String aDestinationName, BaseUIMAAsynchronousEngineCommon_impl engine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcleanup()Cleanup any jms resources used by the worker threadjavax.jms.BytesMessagecreateBytesMessage()javax.jms.TextMessagecreateTextMessage()protected java.lang.StringgetDestinationEndpoint()Returns the full name of the destination queuejavax.jms.MessageProducergetMessageProducer()Returns jsm MessageProducerjavax.jms.MessageProducergetMessageProducer(javax.jms.Destination destination)protected voidinitializeProducer()Creates a jms session object used to instantiate message producervoidsetConnection(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
-
-
-
-
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:
getMessageProducerin interfaceMessageSender- Overrides:
getMessageProducerin classBaseMessageSender- 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:
setConnectionin interfaceMessageSender- Specified by:
setConnectionin classBaseMessageSender
-
initializeProducer
protected void initializeProducer() throws java.lang.ExceptionCreates a jms session object used to instantiate message producer- Specified by:
initializeProducerin classBaseMessageSender- Throws:
java.lang.Exception
-
getDestinationEndpoint
protected java.lang.String getDestinationEndpoint() throws java.lang.ExceptionReturns the full name of the destination queue- Specified by:
getDestinationEndpointin classBaseMessageSender- Throws:
java.lang.Exception
-
getMessageProducer
public javax.jms.MessageProducer getMessageProducer()
Returns jsm MessageProducer- Specified by:
getMessageProducerin interfaceMessageSender- Specified by:
getMessageProducerin classBaseMessageSender
-
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:
cleanupin classBaseMessageSender
-
-