public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) { _tracker = new SpoutTrackOutputCollector(collector); _delegate.open(conf, context, new SpoutOutputCollector(_tracker)); }
@Override public void ack(Object msgId) { Long batchId = _msgIdToBatchId.remove((Long) msgId); FinishCondition cond = _finishConditions.get(batchId); if (cond != null) { cond.vals.remove((Long) msgId); if (cond.vals.isEmpty()) { _finishConditions.remove(batchId); _delegate.ack(cond.msgId); } } }
@Override public void activate() { _delegate.activate(); }
stormTopologyContext.getThisTaskId(), ctx); this.spout.open(stormConfig, stormTopologyContext, new SpoutOutputCollector(collector)); this.spout.activate(); this.spout.nextTuple(); if (counter >= 0) { while ((--counter >= 0) && this.isRunning) { this.spout.nextTuple(); this.spout.nextTuple(); } while (collector.tupleEmitted && this.isRunning);
@Override public void emitBatch(TransactionAttempt tx, Object coordinatorMeta, TridentCollector collector) { long txid = tx.getTransactionId(); long now = System.currentTimeMillis(); if (now - lastRotate > rotateTime) { Map<Long, List<Object>> failed = idsMap.rotate(); for (Long id : failed.keySet()) { //TODO: this isn't right... it's not in the map anymore fail(id); } lastRotate = now; } if (idsMap.containsKey(txid)) { fail(txid); } _collector.reset(collector); if (!prepared) { _spout.open(_conf, _context, new SpoutOutputCollector(_collector)); prepared = true; } for (int i = 0; i < _maxBatchSize; i++) { _spout.nextTuple(); if (_collector.numEmitted < i) { break; } } idsMap.put(txid, _collector.ids); _collector.pendingCount = idsMap.size(); }
@Override public void close() { _delegate.close(); }
@Override public void fail(Object msgId) { Long batchId = _msgIdToBatchId.remove((Long) msgId); FinishCondition cond = _finishConditions.remove(batchId); if (cond != null) { _delegate.fail(cond.msgId); } }
@Override public Map<String, Object> getComponentConfiguration() { return _spout.getComponentConfiguration(); }
@Override public void nextTuple() { _delegate.nextTuple(); }
public void declareOutputFields(OutputFieldsDeclarer declarer) { _delegate.declareOutputFields(declarer); }
@Override public void deactivate() { _delegate.deactivate(); }
@Override public void close() { _spout.close(); }
public void fail(Object msgId) { _delegate.fail(msgId); Map<String, Object> stats = (Map<String, Object>) RegisteredGlobalState.getState(_trackId); ((AtomicInteger) stats.get("processed")).incrementAndGet(); }
@Override public Map<String, Object> getComponentConfiguration() { Map<String, Object> conf = _delegate.getComponentConfiguration(); if (conf == null) { conf = new HashMap<>(); } else { conf = new HashMap<>(conf); } Config.registerSerialization(conf, RichSpoutBatchId.class, RichSpoutBatchIdSerializer.class); return conf; }
public void nextTuple() { _delegate.nextTuple(); }
@Override public void declareOutputFields(OutputFieldsDeclarer declarer) { this.spout.declareOutputFields(declarer); }
@Override public void deactivate() { _delegate.deactivate(); }
@Override public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) { _delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector))); _outputTasks = new ArrayList<>(); for (String component : Utils.get(context.getThisTargets(), _coordStream, new HashMap<String, Grouping>()).keySet()) { _outputTasks.addAll(context.getComponentTasks(component)); } _rand = new Random(Utils.secureRandomLong()); }
public void close() { _delegate.close(); }