There's nothing that keeps you from simply having a thread pool in your bolts. Or you could go for an async DB client.
You will have to be careful about providing back pressure (e.g. by using a bounded queue). On Sun, May 8, 2016 at 12:12 PM, Navin Ipe <navin....@searchlighthealth.com> wrote: > Hi, > > I've wanted to do this and this post confirms the idea: > http://stackoverflow.com/a/36106683/453673 > But when I have a spout that constantly has nextTuple() being called by > Storm and I have a bolt that constantly has execute() being called whenever > it receives a tuple, how do I program the Spout to have a separate thread > which reads from MongoDB or for the bolt to have a separate thread that > writes to DB? > > If Storm is in complete charge of calling nextTuple() and execute(), then > how do I start my own thread which does something? This is important, > because I don't want my bolt to spend time writing to DB, when it should > actually be busy receiving and processing hundreds of tuples. > > -- > Regards, > Navin >