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 void
cleanup()
Cleanup any jms resources used by the worker threadjavax.jms.BytesMessage
createBytesMessage()
javax.jms.TextMessage
createTextMessage()
protected java.lang.String
getDestinationEndpoint()
Returns the full name of the destination queuejavax.jms.MessageProducer
getMessageProducer()
Returns jsm MessageProducerjavax.jms.MessageProducer
getMessageProducer(javax.jms.Destination destination)
protected void
initializeProducer()
Creates a jms session object used to instantiate message producervoid
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
-
-
-
-
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 interfaceMessageSender
- Overrides:
getMessageProducer
in 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:
setConnection
in interfaceMessageSender
- Specified by:
setConnection
in classBaseMessageSender
-
initializeProducer
protected void initializeProducer() throws java.lang.Exception
Creates a jms session object used to instantiate message producer- Specified by:
initializeProducer
in classBaseMessageSender
- 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 classBaseMessageSender
- Throws:
java.lang.Exception
-
getMessageProducer
public javax.jms.MessageProducer getMessageProducer()
Returns jsm MessageProducer- Specified by:
getMessageProducer
in interfaceMessageSender
- Specified by:
getMessageProducer
in 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:
cleanup
in classBaseMessageSender
-
-