Package org.apache.storm.starter.streams

# Class StatefulWordCount

java.lang.Object
org.apache.storm.starter.streams.StatefulWordCount

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 Summary

  Constructors
  Constructor
  Description
  `StatefulWordCount()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `main(String[] args)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### StatefulWordCount

    public StatefulWordCount()

- ## Method Details

  - ### main

    public static void main(String[] args) throws Exception
    Throws:
      `Exception`