What does redis.publish();
method do in the following module.
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));
}
It publishes the string (ExclamatedWord + "|30") to a Redis channel called WordCountTopology
- subscribers to that channel will get the message once redis.publish
executes.
For more information about Redis' Pub/Sub see: http://redis.io/topics/pubsub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With