use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class TestWordSpout method nextTuple.
public void nextTuple() {
final String word = words[rand.nextInt(words.length)];
collector.emit(new Values(word));
if (!throttleDuration.isZero()) {
// sleep to throttle back CPU usage
SysUtils.sleep(throttleDuration);
}
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class RandomIntegerSpout method nextTuple.
@Override
public void nextTuple() {
Utils.sleep(100);
collector.emit(new Values(rand.nextInt(1000), System.currentTimeMillis() - (24 * 60 * 60 * 1000), ++msgId), msgId);
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class StatefulABSpout method nextTuple.
@Override
public void nextTuple() {
String word = TO_SEND[emitted % TO_SEND.length];
if (appendSequenceId) {
word = word + "_" + emitted;
}
collector.emit(new Values(word));
if (!state.containsKey(word)) {
state.put(word, 1);
} else {
state.put(word, state.get(word) + 1);
}
emitted++;
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class CustomSpout method nextTuple.
@Override
public void nextTuple() {
CustomObject obj = inputObjects[(emitted++) % inputObjects.length];
collector.emit(new Values(obj));
}
use of org.apache.heron.api.tuple.Values in project heron by twitter.
the class TestSpout method nextTuple.
@Override
public void nextTuple() {
// It will emit A, B, A, B, A, B, A, B, A, B
if (emitted < EMIT_COUNT) {
String word = toSend[emitted % toSend.length];
emit(outputCollector, new Values(word), MESSAGE_ID, emitted++);
}
}
Aggregations