Direct grouping
In direct grouping, the emitter decides where each tuple will go for processing. For example, say we have a log stream and we want to process each log entry to be processed by a specific bolt task on the basis of the type of resource. In this case, we can use direct grouping.
Direct grouping can only be used with direct streams. To declare a stream as a direct stream, use the backtype.storm.topology.OutputFieldsDeclarer.declareStream method, which takes a boolean parameter. Once you have a direct stream to emit to, use backtype.storm.task.OutputCollector.emitDirect instead of emit methods to emit it. The emitDirect method takes a taskId parameter to specify the task. You can get the number of tasks for a component using the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access