Execution flow of a storm program

百般思念 提交于 2019-12-10 05:17:07

问题


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 ?


回答1:


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



来源:https://stackoverflow.com/questions/28981197/execution-flow-of-a-storm-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!