use of storm.trident.tuple.TridentTuple in project storm by nathanmarz.
the class GroupedMultiReducerExecutor method complete.
@Override
public void complete(Map<TridentTuple, Object> state, TridentCollector collector) {
for (Map.Entry e : state.entrySet()) {
TridentTuple group = (TridentTuple) e.getKey();
Object val = e.getValue();
_reducer.complete(val, group, collector);
}
}
use of storm.trident.tuple.TridentTuple in project storm-hbase by jrkinley.
the class HBaseValueUpdater method updateState.
/**
* {@inheritDoc}
*/
@Override
public void updateState(HBaseValueState state, List<TridentTuple> tuples, TridentCollector collector) {
List<Put> puts = new ArrayList<Put>();
for (TridentTuple t : tuples) {
puts.add(state.getConf().getPutFromTridentTuple(t));
}
state.setValuesBulk(puts);
}
use of storm.trident.tuple.TridentTuple in project jstorm by alibaba.
the class TridentWindowingInmemoryStoreTopology method buildTopology.
public static StormTopology buildTopology(WindowsStoreFactory windowStore, WindowConfig windowConfig) throws Exception {
FixedBatchSpout spout = new FixedBatchSpout(new Fields("sentence"), 3, new Values("the cow jumped over the moon"), new Values("the man went to the store and bought some candy"), new Values("four score and seven years ago"), new Values("how many apples can you eat"), new Values("to be or not to be the person"));
spout.setCycle(true);
TridentTopology topology = new TridentTopology();
Stream stream = topology.newStream("spout1", spout).parallelismHint(16).each(new Fields("sentence"), new Split(), new Fields("word")).window(windowConfig, windowStore, new Fields("word"), new CountAsAggregator(), new Fields("count")).peek(new Consumer() {
@Override
public void accept(TridentTuple input) {
LOG.info("Received tuple: [{}]", input);
}
});
return topology.build();
}
use of storm.trident.tuple.TridentTuple in project jstorm by alibaba.
the class GroupedMultiReducerExecutor method complete.
@Override
public void complete(Map<TridentTuple, Object> state, TridentCollector collector) {
for (Map.Entry e : state.entrySet()) {
TridentTuple group = (TridentTuple) e.getKey();
Object val = e.getValue();
_reducer.complete(val, group, collector);
}
}
use of storm.trident.tuple.TridentTuple in project jstorm by alibaba.
the class ChainedAggregatorImpl method aggregate.
public void aggregate(ChainedResult val, TridentTuple tuple, TridentCollector collector) {
val.setFollowThroughCollector(collector);
for (int i = 0; i < _aggs.length; i++) {
TridentTuple projected = _inputFactories[i].create((TridentTupleView) tuple);
_aggs[i].aggregate(val.objs[i], projected, val.collectors[i]);
}
}
Aggregations