What does the redis.publish () 'Redis method do?

What the method does in the next module. redis.publish();

redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));

public void execute(Tuple tuple)
    {
      String word = tuple.getString(0);

      StringBuilder exclamatedWord = new StringBuilder();
      exclamatedWord.append(word).append("!!!");

      _collector.emit(tuple, new Values(exclamatedWord.toString()));

      long count = 30;
      redis.publish("WordCountTopology", exclamatedWord.toString() + "|" + Long.toString(count));
    }
+4
source share
1 answer

It publishes a line (ExclamatedWord + "| 30") in the Redis channel under the name WordCountTopology- subscribers of this channel will receive a message after execution redis.publish.

For more information about Redis' Pub / Sub, see http://redis.io/topics/pubsub

+6
source

All Articles