Package org.apache.storm.starter
Class StatefulTopology
- java.lang.Object
-
- org.apache.storm.starter.StatefulTopology
-
public class StatefulTopology extends Object
An example topology that demonstrates the use ofIStatefulBolt
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.yamltopology.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"}}'
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StatefulTopology.PrinterBolt
-
Constructor Summary
Constructors Constructor Description StatefulTopology()
-