Package org.apache.storm.jms.trident

## Class TridentJmsSpout

- java.lang.Object
- - org.apache.storm.jms.trident.TridentJmsSpout

- All Implemented Interfaces:
    `Serializable`, `ITridentDataSource`, `ITridentSpout<JmsBatch>`

      public class TridentJmsSpout
      extends Object
      implements ITridentSpout<JmsBatch>

  Trident implementation of the JmsSpout.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.storm.trident.spout.ITridentSpout

      `ITridentSpout.BatchCoordinator<X>, ITridentSpout.Emitter<X>`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DEFAULT_BATCH_SIZE` |
    `static String` | `MAX_BATCH_SIZE_CONF` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TridentJmsSpout()` | Create a TridentJmsSpout with a default name and acknowledge mode of AUTO_ACKNOWLEDGE.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Map<String,​Object>` | `getComponentConfiguration()` |
    `ITridentSpout.BatchCoordinator<JmsBatch>` | `getCoordinator​(String txStateId, Map<String,​Object> conf, TopologyContext context)` | The coordinator for a TransactionalSpout runs in a single thread and indicates when batches of tuples should be emitted.
    `ITridentSpout.Emitter<JmsBatch>` | `getEmitter​(String txStateId, Map<String,​Object> conf, TopologyContext context)` | The emitter for a TransactionalSpout runs as many tasks across the cluster.
    `Fields` | `getOutputFields()` |
    `TridentJmsSpout` | `named​(String name)` | Set the name for this spout, to improve log identification.
    `TridentJmsSpout` | `withJmsAcknowledgeMode​(int jmsAcknowledgeMode)` | Set the JMS acknowledge mode for messages being processed by this spout.
    `TridentJmsSpout` | `withJmsProvider​(JmsProvider provider)` | Set the `JmsProvider` implementation that this Spout will use to connect to a JMS `javax.jms.Desination`.
    `TridentJmsSpout` | `withTupleProducer​(JmsTupleProducer tupleProducer)` | Set the `JmsTupleProducer` implementation that will convert `javax.jms.Message` object to `backtype.storm.tuple.Values` objects to be emitted.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAX_BATCH_SIZE_CONF

          public static final String MAX_BATCH_SIZE_CONF

      See Also:
        Constant Field Values

    - #### DEFAULT_BATCH_SIZE

          public static final int DEFAULT_BATCH_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TridentJmsSpout

          public TridentJmsSpout()

      Create a TridentJmsSpout with a default name and acknowledge mode of AUTO_ACKNOWLEDGE.

  - ### Method Detail

    - #### named

          public TridentJmsSpout named​(String name)

      Set the name for this spout, to improve log identification.
      Parameters:
        `name` - The name to be used in log messages
      Returns:
        This spout

    - #### withJmsProvider

          public TridentJmsSpout withJmsProvider​(JmsProvider provider)

      Set the `JmsProvider` implementation that this Spout will use to connect to a JMS `javax.jms.Desination`.

    - #### withTupleProducer

          public TridentJmsSpout withTupleProducer​(JmsTupleProducer tupleProducer)

      Set the `JmsTupleProducer` implementation that will convert `javax.jms.Message` object to `backtype.storm.tuple.Values` objects to be emitted.
      Returns:
        This spout

    - #### withJmsAcknowledgeMode

          public TridentJmsSpout withJmsAcknowledgeMode​(int jmsAcknowledgeMode)

      Set the JMS acknowledge mode for messages being processed by this spout.

      Possible values:
      - javax.jms.Session.AUTO_ACKNOWLEDGE
      - javax.jms.Session.CLIENT_ACKNOWLEDGE
      - javax.jms.Session.DUPS_OK_ACKNOWLEDGE
      Parameters:
        `jmsAcknowledgeMode` - The chosen acknowledge mode
      Returns:
        This spout
      Throws:
        `IllegalArgumentException` - if the mode is not recognized

    - #### getCoordinator

          public ITridentSpout.BatchCoordinator<JmsBatch> getCoordinator​(String txStateId,
                                                                         Map<String,​Object> conf,
                                                                         TopologyContext context)

      Description copied from interface: `ITridentSpout`
      The coordinator for a TransactionalSpout runs in a single thread and indicates when batches of tuples should be emitted. The Coordinator that you provide in a TransactionalSpout provides metadata for each transaction so that the transactions can be replayed in case of failure.

      Two instances are requested, one on the master batch coordinator where isReady() is called, and an instance in the coordinator bolt which is used for all other operations. The two instances do not necessarily share a worker JVM.

      Specified by:
        `getCoordinator` in interface `ITridentSpout<JmsBatch>`
      Parameters:
        `txStateId` - stream id
        `conf` - Storm config map
        `context` - topology context
      Returns:
        spout coordinator instance

    - #### getEmitter

          public ITridentSpout.Emitter<JmsBatch> getEmitter​(String txStateId,
                                                            Map<String,​Object> conf,
                                                            TopologyContext context)

      Description copied from interface: `ITridentSpout`
      The emitter for a TransactionalSpout runs as many tasks across the cluster. Emitters are responsible for emitting batches of tuples for a transaction and must ensure that the same batch of tuples is always emitted for the same transaction id.

      All emitter tasks get the same transaction metadata. The topology context parameter contains the instance task id that can be used to distribute the work across the tasks.

      Specified by:
        `getEmitter` in interface `ITridentSpout<JmsBatch>`
      Parameters:
        `txStateId` - stream id
        `conf` - Storm config map
        `context` - topology context
      Returns:
        spout emitter

    - #### getComponentConfiguration

          public Map<String,​Object> getComponentConfiguration()

      Specified by:
        `getComponentConfiguration` in interface `ITridentSpout<JmsBatch>`

    - #### getOutputFields

          public Fields getOutputFields()

      Specified by:
        `getOutputFields` in interface `ITridentSpout<JmsBatch>`