Apache Storm Bolt is a component of the Storm cluster that is used to take stream as input, perform some processing, and produce a new stream. Bolt can perform filtering, joining, aggregations, and so on. To define Bolt in Java, we can use the IRichBolt interface.
Apache Storm Bolt's lifecycle goes through the following steps.
- When we write Bolt, an IBolt object is created on the user (client) system.
- After this, the IBolt object is serialized by applying Java serialization and submitted on the Nimbus node for processing.
- Nimbus node starts workers node to process tuples.
Apache Storm Bolt Structure
The following are the methods of Apache Storm Bolt.
- declareOutputFields(OutputFieldsDeclarer declarers): This method is used to declare output schema for bolt.
- prepare(java.util.Map stormConf, TopologyContext context, OutputCollector col lector): This method is called before processing of tuples.
- execute(Tuple input): This method is used to process one input tuple.
- cleanup(): During shut down of bolt, this message is called.
The following figure shows the processing of Bolt.