public class KafkaTridentOpaqueSpoutEmitter<K,V> extends Object implements IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>, Serializable
Constructor and Description |
---|
KafkaTridentOpaqueSpoutEmitter(KafkaTridentSpoutEmitter<K,V> emitter) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
Map<String,Object> |
emitPartitionBatch(TransactionAttempt tx,
TridentCollector collector,
KafkaTridentSpoutTopicPartition partition,
Map<String,Object> lastPartitionMeta)
Emit a batch of tuples for a partition/transaction.
|
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.
|
public KafkaTridentOpaqueSpoutEmitter(KafkaTridentSpoutEmitter<K,V> emitter)
public Map<String,Object> emitPartitionBatch(TransactionAttempt tx, TridentCollector collector, KafkaTridentSpoutTopicPartition partition, Map<String,Object> lastPartitionMeta)
IOpaquePartitionedTridentSpout.Emitter
Emit 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.
emitPartitionBatch
in interface IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>
public void refreshPartitions(List<KafkaTridentSpoutTopicPartition> partitionResponsibilities)
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.
refreshPartitions
in interface IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>
partitionResponsibilities
- The partitions assigned to this taskpublic List<KafkaTridentSpoutTopicPartition> getOrderedPartitions(List<Map<String,Object>> allPartitionInfo)
IOpaquePartitionedTridentSpout.Emitter
Sorts the partition info to produce an ordered list of partition.
getOrderedPartitions
in interface IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>
allPartitionInfo
- The partition info for all partitions being processed by all spout taskspublic List<KafkaTridentSpoutTopicPartition> getPartitionsForTask(int taskId, int numTasks, List<KafkaTridentSpoutTopicPartition> allPartitionInfoSorted)
IOpaquePartitionedTridentSpout.Emitter
Get the partitions assigned to this task.
getPartitionsForTask
in interface IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>
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 to IOpaquePartitionedTridentSpout.Emitter.getOrderedPartitions(java.lang.Object)
taskId
public void close()
close
in interface IOpaquePartitionedTridentSpout.Emitter<List<Map<String,Object>>,KafkaTridentSpoutTopicPartition,Map<String,Object>>
Copyright © 2020 The Apache Software Foundation. All rights reserved.