public void updateWith(Rankings other) { for (Rankable r : other.getRankings()) { updateWith(r); } }
@Override public void execute(Tuple tuple) { Rankings rankableList = (Rankings) tuple.getValue(0); for (Rankable r: rankableList.getRankings()){ String word = r.getObject().toString(); Long count = r.getCount(); redis.publish("WordCountTopology", word + "|" + Long.toString(count)); } // access the first column 'word' //String word = tuple.getStringByField("word"); // access the second column 'count' //String word = rankedWords.toString(); //Integer count = tuple.getIntegerByField("count"); //Long count = new Long(100); // publish the word count to redis using word as the key //redis.publish("WordCountTopology", word + ":" + Long.toString(count)); }