use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class ABSpout method nextTuple.
@Override
public void nextTuple() {
String word = TO_SEND[emitted % TO_SEND.length];
if (appendSequenceId) {
word = word + "_" + emitted;
}
collector.emit(new Values(word));
emitted++;
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class TestFibonacciSpout method nextTuple.
@Override
public void nextTuple() {
Utils.sleep(100);
final int[] words = new int[] { 0, 1, 2, 3, 5, 8, 13, 21, 34 };
final Random rand = new Random();
final int number = words[rand.nextInt(words.length)];
final String property = holder.getProperty();
final int numberProperty = holder.getNumberProperty();
final String publicProperty = holder.publicProperty;
LOG.info("Constructor Args: " + property);
LOG.info("Property set by setter: " + numberProperty);
LOG.info("Property set by public field: " + publicProperty);
LOG.info("Emitting: number " + number);
collector.emit(new Values(number));
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class StatefulNumberSpout method nextTuple.
@Override
public void nextTuple() {
Utils.sleep(1000);
long val = msgId;
long randomNumber = System.currentTimeMillis() - (24 * 60 * 60 * 1000);
System.out.println("Emitting: " + val);
collector.emit(new Values(val, randomNumber, msgId), msgId);
msgId++;
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class StatefulWindowSumBolt method execute.
@Override
public void execute(TupleWindow inputWindow) {
for (Tuple tuple : inputWindow.get()) {
System.out.println("Adding to sum: " + tuple.getLongByField("value"));
sum += tuple.getLongByField("value");
System.out.println("Sum is now: " + sum);
}
collector.emit(new Values(sum));
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class EmitDirectRoundRobinBolt method execute.
@Override
public void execute(Tuple tuple) {
String word = toSend[emitted % toSend.length];
outputCollector.emitDirect(emitted, new Values(word));
}
Aggregations