public class StatefulWordCount extends Object
A stateful word count that uses PairStream.updateStateByKey(StateUpdater)
to save the counts in a key value state. This example uses Redis state store.
You should start a local redis instance before running the ‘storm jar’ command. By default the connection will be attempted at localhost:6379. 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 and Description |
---|
StatefulWordCount() |
Copyright © 2019 The Apache Software Foundation. All rights reserved.