use of org.apache.storm.starter.tools.RankableObjectWithFields in project streaming-samples by ashvina.
the class PartialRanker method execute.
@Override
public void execute(Tuple tuple, BasicOutputCollector collector) {
restriction.execute();
String trend = tuple.getStringByField(FIELD_TREND);
Long count = tuple.getLongByField(FIELD_COUNT);
RankableObjectWithFields rankable = new RankableObjectWithFields(trend, count, "");
rankings.updateWith(rankable);
if (System.currentTimeMillis() - previousEmitTime > emitRate.toMillis()) {
collector.emit(new Values(rankings.copy()));
previousEmitTime = System.currentTimeMillis();
}
}
Aggregations