Package org.apache.storm.trident.spout
Interface IOpaquePartitionedTridentSpout.Emitter<PartitionsT,PartitionT extends ISpoutPartition,M>
-
- All Known Implementing Classes:
KafkaTridentOpaqueSpoutEmitter
- Enclosing interface:
- IOpaquePartitionedTridentSpout<PartitionsT,PartitionT extends ISpoutPartition,M>
public static interface IOpaquePartitionedTridentSpout.Emitter<PartitionsT,PartitionT extends ISpoutPartition,M>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Map<PartitionT,M>emitBatchNew(TransactionAttempt tx, TridentCollector collector, Set<PartitionT> partitions, Map<PartitionT,M> lastBatchMetaMap)Emit a batch of tuples for a list of partitions/transactions.List<PartitionT>getOrderedPartitions(PartitionsT allPartitionInfo)Sorts the partition info to produce an ordered list of partition.default List<PartitionT>getPartitionsForTask(int taskId, int numTasks, List<PartitionT> allPartitionInfoSorted)Get the partitions assigned to this task.voidrefreshPartitions(List<PartitionT> partitionResponsibilities)This method is called when this task is responsible for a new set of partitions.
-
-
-
Method Detail
-
emitBatchNew
Map<PartitionT,M> emitBatchNew(TransactionAttempt tx, TridentCollector collector, Set<PartitionT> partitions, Map<PartitionT,M> lastBatchMetaMap)
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.
-
refreshPartitions
void refreshPartitions(List<PartitionT> partitionResponsibilities)
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.- Parameters:
partitionResponsibilities- The partitions assigned to this task
-
getOrderedPartitions
List<PartitionT> getOrderedPartitions(PartitionsT allPartitionInfo)
Sorts the partition info to produce an ordered list of partition.- 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
default List<PartitionT> getPartitionsForTask(int taskId, int numTasks, List<PartitionT> allPartitionInfoSorted)
Get the partitions assigned to this task.- 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 togetOrderedPartitions(java.lang.Object)- Returns:
- The list of partitions that are to be processed by the task with id
taskId
-
close
void close()
-
-