Package org.apache.storm.kafka.spout.trident

## Class KafkaTridentOpaqueSpoutEmitter<K,​V>

- java.lang.Object
- - org.apache.storm.kafka.spout.trident.KafkaTridentOpaqueSpoutEmitter<K,​V>

- All Implemented Interfaces:
    `Serializable`, `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`

      public class KafkaTridentOpaqueSpoutEmitter<K,​V>
      extends Object
      implements IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>, Serializable

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KafkaTridentOpaqueSpoutEmitter​(KafkaTridentSpoutEmitter<K,​V> emitter)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `Map<KafkaTridentSpoutTopicPartition,​Map<String,​Object>>` | `emitBatchNew​(TransactionAttempt tx, TridentCollector collector, Set<KafkaTridentSpoutTopicPartition> partitions, Map<KafkaTridentSpoutTopicPartition,​Map<String,​Object>> lastBatchMetaMap)` | Emit a batch of tuples for a list of partitions/transactions.
    `List<KafkaTridentSpoutTopicPartition>` | `getOrderedPartitions​(List<Map<String,​Object>> allPartitionInfo)` | Sorts the partition info to produce an ordered list of partition.
    `List<KafkaTridentSpoutTopicPartition>` | `getPartitionsForTask​(int taskId, int numTasks, List<KafkaTridentSpoutTopicPartition> allPartitionInfoSorted)` | Get the partitions assigned to this task.
    `void` | `refreshPartitions​(List<KafkaTridentSpoutTopicPartition> partitionResponsibilities)` | This method is called when this task is responsible for a new set of partitions.

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

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

- - ### Constructor Detail

    - #### KafkaTridentOpaqueSpoutEmitter

          public KafkaTridentOpaqueSpoutEmitter​(KafkaTridentSpoutEmitter<K,​V> emitter)

  - ### Method Detail

    - #### emitBatchNew

          public Map<KafkaTridentSpoutTopicPartition,​Map<String,​Object>> emitBatchNew​(TransactionAttempt tx,
                                                                                                  TridentCollector collector,
                                                                                                  Set<KafkaTridentSpoutTopicPartition> partitions,
                                                                                                  Map<KafkaTridentSpoutTopicPartition,​Map<String,​Object>> lastBatchMetaMap)

      Description copied from interface: `IOpaquePartitionedTridentSpout.Emitter`
      Emit a batch of tuples for a list of partitions/transactions.

      Return the map of metadata describing this batch that will be used as lastPartitionMeta for defining the parameters of the next batch for each partition.

      Specified by:
        `emitBatchNew` in interface `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`

    - #### refreshPartitions

          public void refreshPartitions​(List<KafkaTridentSpoutTopicPartition> partitionResponsibilities)

      Description copied from interface: `IOpaquePartitionedTridentSpout.Emitter`
      This method is called when this task is responsible for a new set of partitions. Should be used to manage things like connections to brokers.
      Specified by:
        `refreshPartitions` in interface `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`
      Parameters:
        `partitionResponsibilities` - The partitions assigned to this task

    - #### getOrderedPartitions

          public List<KafkaTridentSpoutTopicPartition> getOrderedPartitions​(List<Map<String,​Object>> allPartitionInfo)

      Description copied from interface: `IOpaquePartitionedTridentSpout.Emitter`
      Sorts the partition info to produce an ordered list of partition.
      Specified by:
        `getOrderedPartitions` in interface `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`
      Parameters:
        `allPartitionInfo` - The partition info for all partitions being processed by all spout tasks
      Returns:
        The ordered list of partitions being processed by all the tasks. The ordering must be consistent for all tasks.

    - #### getPartitionsForTask

          public List<KafkaTridentSpoutTopicPartition> getPartitionsForTask​(int taskId,
                                                                            int numTasks,
                                                                            List<KafkaTridentSpoutTopicPartition> allPartitionInfoSorted)

      Description copied from interface: `IOpaquePartitionedTridentSpout.Emitter`
      Get the partitions assigned to this task.
      Specified by:
        `getPartitionsForTask` in interface `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`
      Parameters:
        `taskId` - The id of this task
        `numTasks` - The number of tasks for this spout
        `allPartitionInfoSorted` - The partition info for all partitions being processed by all spout tasks, sorted according to `IOpaquePartitionedTridentSpout.Emitter.getOrderedPartitions(java.lang.Object)`
      Returns:
        The list of partitions that are to be processed by the task with id `taskId`

    - #### close

          public void close()

      Specified by:
        `close` in interface `IOpaquePartitionedTridentSpout.Emitter<List<Map<String,​Object>>,​KafkaTridentSpoutTopicPartition,​Map<String,​Object>>`