Local mode simulates a Storm cluster in process and is useful for developing and testing topologies. Running topologies in local mode is similar to running topologies on a cluster.
To create an in-process cluster, simply use the LocalCluster
class. For example:
import org.apache.storm.LocalCluster;
LocalCluster cluster = new LocalCluster();
You can then submit topologies using the submitTopology
method on the LocalCluster
object. Just like the corresponding method on StormSubmitter, submitTopology
takes a name, a topology configuration, and the topology object. You can then kill a topology using the killTopology
method which takes the topology name as an argument.
To shutdown a local cluster, simple call:
cluster.shutdown();
You can see a full list of configurations here.