The bolt just needs to “put” the values into the Key-Value state that the bolt 
gets initialized with during “initState”. The framework automatically takes 
care of saving the state behind the scenes.

Theres an example in storm-starter that you might find useful - 
https://github.com/apache/storm/blob/master/examples/storm-starter/src/jvm/org/apache/storm/starter/StatefulTopology.java

You can also find the more elaborate documentation here - 
https://github.com/apache/storm/blob/master/docs/State-checkpointing.md

Thanks,
Arun

From:  "Wijekoon, Manusha" <[email protected]>
Reply-To:  "[email protected]" <[email protected]>
Date:  Monday, July 24, 2017 at 4:04 PM
To:  "[email protected]" <[email protected]>
Subject:  is stateful bolts production ready?

Hello

 

I am thinking of using stateful bolts to manage state of a bolt. From the 
documentation it is not clear how to save the bolt state however. I understand 
it has to be done when we process the checkpoint tuple, but how? Do I just need 
to update the state object and storm pick it up during three phase commit? How 
does Strom know which state object to pick for check pointing?

 

I wasn’t able to fine more complete examples either, specifically when we can’t 
keep the state in a kev/value map. 

 

Also, Is this functionality tested in production like environments before? 

 

 

Thanks

M

Reply via email to