u12345
u12345

Reputation: 389

Execution flow of a storm program

I am new in storm and trying to understand the flow of execution of different methods from spout to bolt . Like spout has different methods like

nextTuple()

open()

declareOutputFields()

activate()

deactivate()

and bolt has methods like

prepare()

execute()

cleanup()

declareOutputFields()

so can anyone tell me the sequence of execution of these methods ?

Upvotes: 8

Views: 3185

Answers (1)

Kit Menke
Kit Menke

Reputation: 7056

First, when your topology is started...

  1. Create Spouts and Bolts
  2. declareOutputFields
  3. Spouts/Bolts serialized and assigned to workers

Second, in each worker somewhere on the cluster...

  1. Spouts open and Bolts prepare (happens once)
  2. In a loop...
    • Spouts call ack, fail, and nextTuple
    • Bolts call execute

If your topology is deactivated...

  • Your spouts deactivate method will be called. When you activate the topology again then activate will be called.

If your topology is killed...

  • Spouts might have close called
  • Bolts might have cleanup called

Note:

There is no guarentee that close will be called, because the supervisor kill -9's worker processes on the cluster. source

Upvotes: 14

Related Questions