Is it possible for a bolt receive multiple input tuples from different spout/bolt? For instance, Bolt C receive input tuples from Spout A and input tuples from Bolt B to be processed. How should I implement it? I mean writing the Java code for Bolt C and also its topology.
Tutorial answers your question.
https://storm.apache.org/documentation/Tutorial.html
Here is the code for your goal(C/P from tutorial):
builder.setBolt("exclaim2", new ExclamationBolt(), 5)
.shuffleGrouping("words")
.shuffleGrouping("exclaim1");
exclaim2
will accept tuples from both words
and exclaim1
, both using shuffle grouping.
Yes Possible. Only thing to take care is it should follow DAG structure. In your case, below is the flow. 1. Spout reads the data and sends to bolt C 2. Same Spout reads the data and sends to bolt B 3. Bolt B filters some data and forwards to Bolt C
来源:https://stackoverflow.com/questions/30410661/an-apache-storm-bolt-receive-multiple-input-tuples-from-different-spout-bolt