Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An Apache Storm bolt receive multiple input tuples from different spout/bolt

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.

like image 647
Toshihiko Avatar asked May 23 '15 08:05

Toshihiko


People also ask

What are spouts and bolts in Storm?

Spout emits the data to one or more bolts. Bolt represents a node in the topology having the smallest processing logic and the output of a bolt can be emitted into another bolt as input. Storm keeps the topology always running, until you kill the topology.

Which of the following method is used for initialising spout in Apache Storm?

Bolt Creationprepare − Provides the bolt with an environment to execute. The executors will run this method to initialize the spout.

Which of the following method is used to declare the schema of tuple in Apache Storm?

OutputFieldsDeclarer: used to declare streams and their schemas.

Which of the following method of Storm topology is called when a spout is going to shutdown?

close − This method is called when a spout is going to shutdown. declareOutputFields − Declares the output schema of the tuple. fail − Specifies that a specific tuple is not processed and not to be reprocessed.


1 Answers

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.

like image 196
Seçkin Savaşçı Avatar answered Sep 24 '22 14:09

Seçkin Savaşçı