/** * Emits a new tuple to the default stream anchored on a single tuple. The * emitted values must be immutable. * * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(Tuple anchor, List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, anchor, tuple); }
/** * Emits a new tuple to the default stream anchored on a group of input * tuples. The emitted values must be immutable. * * @param anchors the tuples to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(Collection<Tuple> anchors, List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, anchors, tuple); }
/** * Emits a new unanchored tuple to the default stream. Beacuse it's * unanchored, if a failure happens downstream, this new tuple won't affect * whether any spout tuples are considered failed or not. The emitted values * must be immutable. * * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, tuple); }
/** * Emits a new unanchored tuple to the specified stream. Because it's * unanchored, if a failure happens downstream, this new tuple won't affect * whether any spout tuples are considered failed or not. The emitted values * must be immutable. * * @param streamId the stream to emit to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(String streamId, List<Object> tuple) { return emit(streamId, (List) null, tuple); }
/** * Emits a new tuple to a specific stream with a single anchor. The emitted * values must be immutable. * * @param streamId the stream to emit to * @param anchor the tuple to anchor to * @param tuple the new output tuple from this bolt * @return the list of task ids that this new tuple was sent to */ public List<Integer> emit(String streamId, Tuple anchor, List<Object> tuple) { return emit(streamId, Arrays.asList(anchor), tuple); }
private void emit(Map<Object, Long> counts, int actualWindowLengthInSeconds) { for (Entry<Object, Long> entry : counts.entrySet()) { Object obj = entry.getKey(); Long count = entry.getValue(); collector.emit(new Values(obj, count, actualWindowLengthInSeconds)); } }
public List<Integer> emit(String stream, Collection<Tuple> anchors, List<Object> tuple) { List<Integer> tasks = _delegate.emit(stream, anchors, tuple, new CollectorCb()); return tasks; }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
@Override public void execute(Tuple tuple) { String sentence = tuple.getString(0); for (String word : sentence.split("\\s+")) { collector.emit(new Values(word)); } }
public void execute(Tuple input) { String word = (String) input.getValues().get(0); int count = (Integer) input.getValues().get(1); _counts.put(word, count); int globalCount = 0; for (String w : _counts.keySet()) { globalCount += _counts.get(w); } _collector.emit(tuple(globalCount)); _collector.ack(input); }
public void execute(Tuple input) { _count++; _collector.emit(input, new Values(_count)); _collector.ack(input); }
public void execute(Tuple input) { Integer sourceId = input.getInteger(0); Long eventId = input.getLong(1); Long recentEvent = recentEventId.get(sourceId); if (null != recentEvent && eventId <= recentEvent) { String error = "Error: event id is not in strict order! event source Id: " + sourceId + ", last event Id: " + recentEvent + ", current event Id: " + eventId; _collector.emit(input, new Values(error)); } recentEventId.put(sourceId, eventId); _collector.ack(input); }
public void execute(Tuple tuple) { if (tuple.getValues().size() == 0) { _expectExcevieNum--; } else { JStormUtils.sleepMs(1); _collector.emit(tuple, new Values(tuple.getValues())); _collector.ack(tuple); } }
@Override public void run() { long newWatermark = watermarkGenerator.getCurrentWatermark(); if (newWatermark > currentWatermark) { LOG.info("Generating new watermark:{}", newWatermark); currentWatermark = newWatermark; collector.emit(Common.WATERMARK_STREAM_ID, new Values(new Watermark(newWatermark))); checkEventTimeWindows(); } } }, watermarkInterval, watermarkInterval, TimeUnit.MILLISECONDS);