/** * 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); }
private void failQueuedTuples(List<Tuple> failedTuples) { for (Tuple failedTuple : failedTuples) { collector.fail(failedTuple); } }
private void failBatch(TrackedBatch tracked, FailedException e) { if (e != null && e instanceof ReportedFailedException) { _collector.reportError(e); } tracked.failed = true; if (tracked.delayedAck != null) { _collector.fail(tracked.delayedAck); tracked.delayedAck = null; } }
@Override public void execute(Tuple input) { if (state) { collector.ack(input); } state = !state; }
@Override public void prepare(Map<String, Object> conf, TopologyContext topologyContext) { this.componentId = topologyContext.getThisComponentId(); this.taskId = topologyContext.getThisTaskId(); }
/** * Gets the declared output fields for the specified stream id for the component this task is a part of. */ public Fields getThisOutputFields(String streamId) { return getComponentOutputFields(getThisComponentId(), streamId); }
@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { componentId = context.getThisComponentId(); this.collector = collector; }
/** * Gets the set of streams declared for the component of this task. */ public Set<String> getThisStreams() { return getComponentStreams(getThisComponentId()); }
/** * Gets the declared inputs to this component. * * @return A map from subscribed component/stream to the grouping subscribed with. */ public Map<GlobalStreamId, Grouping> getThisSources() { return getSources(getThisComponentId()); }
/** * Gets information about who is consuming the outputs of this component, and how. * * @return Map from stream id to component id to the Grouping used. */ public Map<String, Map<String, Grouping>> getThisTargets() { return getTargets(getThisComponentId()); }
@Override public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; _base = context.getThisTaskIndex(); }
public TaskMetrics(WorkerTopologyContext context, String componentId, Integer taskid) { this.topologyId = context.getStormId(); this.componentId = componentId; this.taskId = taskid; this.workerPort = context.getThisWorkerPort(); }
/** * Resets the message timeout for any tuple trees to which the given tuple belongs. The timeout is reset to * Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS. Note that this is an expensive operation, and should be used sparingly. * * @param tuple the tuple to reset timeout for */ public void resetTimeout(Tuple tuple) { out.resetTimeout(tuple); }
/** * @return the component id for this task. The component id maps to a component id specified for a Spout or Bolt in the topology * definition. */ public String getThisComponentId() { return getComponentId(_taskId); }
@Override public void flush() { _delegate.flush(); } }
/** * 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); }
@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { componentId = context.getThisComponentId(); this.collector = collector; }
@Override public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) { this.collector = collector; this.taskIndex = context.getThisTaskIndex(); }
@Override public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) { componentId = context.getThisComponentId(); this.collector = collector; }