Search code examples
apache-storm

Use same class as multiple Bolts in Apache Storm


I'm new to Apache Storm and have been facing issues with the capacity of multiple bolts.

So I have a Class X, which is used as a Bolt. Can there be any bottleneck if we use the same class with the separate instance as multiple Bolts each having a different parallelismHint, like below:

builder.setBolt(BOLT-1, new X());
builder.setBolt(BOLT-2, new X());
builder.setBolt(BOLT-3, new X()); 

Each of above the Bolt is bound to separate Spout.

Thanks in advance! Saurabh


Solution

  • As long as your X class doesn't have static state, this won't be a problem. Each .setBolt causes more instances of X to be spawned, so the bolts are going to be independent.