Class StatefulTopology


public class StatefulTopology extends Object
An example topology that demonstrates the use of IStatefulBolt to manage state. To run the example,
 $ storm jar examples/storm-starter/storm-starter-topologies-*.jar storm.starter.StatefulTopology statetopology

The default state used is 'InMemoryKeyValueState' which does not persist the state across restarts. You could use 'RedisKeyValueState' to test state persistence by setting below property in conf/storm.yaml

 topology.state.provider: org.apache.storm.redis.state.RedisKeyValueStateProvider

You should also start a local redis instance before running the 'storm jar' command. The default RedisKeyValueStateProvider parameters can be overridden in conf/storm.yaml, for e.g.

 topology.state.provider.config: '{"keyClass":"...", "valueClass":"...",
                                   "keySerializerClass":"...", "valueSerializerClass":"...",
                                   "jedisPoolConfig":{"host":"localhost", "port":6379,
                                      "timeout":2000, "database":0, "password":"xyz"}}'


  • Constructor Details

    • StatefulTopology

      public StatefulTopology()
  • Method Details