Search in sources :

Example 1 with RankableObjectWithFields

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();
    }
}
Also used : Values(com.twitter.heron.api.tuple.Values) RankableObjectWithFields(org.apache.storm.starter.tools.RankableObjectWithFields)

Aggregations

Values (com.twitter.heron.api.tuple.Values)1 RankableObjectWithFields (org.apache.storm.starter.tools.RankableObjectWithFields)1