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
Modifier and TypeMethodDescriptionvoidclose()emitPartitionBatch(TransactionAttempt tx, TridentCollector collector, PartitionT partition, M lastPartitionMeta) Emit a batch of tuples for a partition/transaction.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 Details
-
emitPartitionBatch
M emitPartitionBatch(TransactionAttempt tx, TridentCollector collector, PartitionT partition, M lastPartitionMeta) 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.
-
refreshPartitions
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
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()
-