org.apache.uima.adapter.jms.client

## Class ActiveMQMessageSender

- java.lang.Object
- - org.apache.uima.adapter.jms.client.BaseMessageSender
  - - org.apache.uima.adapter.jms.client.ActiveMQMessageSender

- All Implemented Interfaces:
    Runnable, org.apache.uima.adapter.jms.client.MessageSender

      public class ActiveMQMessageSender
      extends org.apache.uima.adapter.jms.client.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 and Description
    `ActiveMQMessageSender(javax.jms.Connection aConnection, String aDestinationName, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl engine)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `cleanup()` Cleanup any jms resources used by the worker thread
    `javax.jms.BytesMessage` | `createBytesMessage()`
    `javax.jms.TextMessage` | `createTextMessage()`
    `protected void` | `dispatchMessage(org.apache.uima.adapter.jms.message.PendingMessage pm, org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl engine, boolean casProcessRequest)`
    `protected 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, initializeMessage, 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,
                                       String aDestinationName,
                                       org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl engine)
                                throws Exception

      Throws:
        `Exception`

  - ### Method Detail

    - #### getMessageProducer

          public javax.jms.MessageProducer getMessageProducer(javax.jms.Destination destination)
                                                       throws Exception

      Specified by:
        `getMessageProducer` in interface `org.apache.uima.adapter.jms.client.MessageSender`
      Overrides:
        `getMessageProducer` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`
      Throws:
        `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 `org.apache.uima.adapter.jms.client.MessageSender`
      Specified by:
        `setConnection` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`

    - #### getDestinationEndpoint

          protected String getDestinationEndpoint()
                                           throws Exception

      Returns the full name of the destination queue
      Specified by:
        `getDestinationEndpoint` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`
      Throws:
        `Exception`

    - #### initializeProducer

          protected void initializeProducer()
                                     throws Exception

      Creates a jms session object used to instantiate message producer
      Specified by:
        `initializeProducer` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`
      Throws:
        `Exception`

    - #### getMessageProducer

          public javax.jms.MessageProducer getMessageProducer()

      Returns jsm MessageProducer
      Specified by:
        `getMessageProducer` in interface `org.apache.uima.adapter.jms.client.MessageSender`
      Specified by:
        `getMessageProducer` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`

    - #### createTextMessage

          public javax.jms.TextMessage createTextMessage()
                                                  throws Exception

      Throws:
        `Exception`

    - #### createBytesMessage

          public javax.jms.BytesMessage createBytesMessage()
                                                    throws Exception

      Throws:
        `Exception`

    - #### cleanup

          protected void cleanup()

      Cleanup any jms resources used by the worker thread
      Specified by:
        `cleanup` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`

    - #### dispatchMessage

          protected void dispatchMessage(org.apache.uima.adapter.jms.message.PendingMessage pm,
                                         org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl engine,
                                         boolean casProcessRequest)
                                  throws Exception

      Specified by:
        `dispatchMessage` in class `org.apache.uima.adapter.jms.client.BaseMessageSender`
      Throws:
        `Exception`

Copyright © 2006–2018 The Apache Software Foundation. All rights reserved.