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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()emitPartitionBatch(TransactionAttempt tx, TridentCollector collector, KafkaTridentSpoutTopicPartition partition, Map<String, Object> lastPartitionMeta) Emit a batch of tuples for a partition/transaction.getOrderedPartitions(List<Map<String, Object>> allPartitionInfo) Sorts the partition info to produce an ordered list of partition.getPartitionsForTask(int taskId, int numTasks, List<KafkaTridentSpoutTopicPartition> allPartitionInfoSorted) Get the partitions assigned to this task.voidrefreshPartitions(List<KafkaTridentSpoutTopicPartition> partitionResponsibilities) This method is called when this task is responsible for a new set of partitions.
-
Constructor Details
-
KafkaTridentOpaqueSpoutEmitter
-
-
Method Details
-
emitPartitionBatch
public Map<String,Object> emitPartitionBatch(TransactionAttempt tx, TridentCollector collector, KafkaTridentSpoutTopicPartition partition, Map<String, Object> lastPartitionMeta) Description copied from interface:IOpaquePartitionedTridentSpout.EmitterEmit a batch of tuples for a partition/transaction.Return the metadata describing this batch that will be used as lastPartitionMeta for defining the parameters of the next batch.
- Specified by:
emitPartitionBatchin interfaceIOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>, KafkaTridentSpoutTopicPartition, Map<String, Object>>
-
refreshPartitions
Description copied from interface:IOpaquePartitionedTridentSpout.EmitterThis 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:
refreshPartitionsin interfaceIOpaquePartitionedTridentSpout.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.EmitterSorts the partition info to produce an ordered list of partition.- Specified by:
getOrderedPartitionsin interfaceIOpaquePartitionedTridentSpout.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.EmitterGet the partitions assigned to this task.- Specified by:
getPartitionsForTaskin interfaceIOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>, KafkaTridentSpoutTopicPartition, Map<String, Object>> - Parameters:
taskId- The id of this tasknumTasks- The number of tasks for this spoutallPartitionInfoSorted- The partition info for all partitions being processed by all spout tasks, sorted according toIOpaquePartitionedTridentSpout.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:
closein interfaceIOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>, KafkaTridentSpoutTopicPartition, Map<String, Object>>
-