/** * If the topology has at least one stateful bolt all the non-stateful bolts * are wrapped in {@link CheckpointTupleForwarder} so that the checkpoint * tuples can flow through the topology. */ private IRichBolt maybeAddCheckpointTupleForwarder(IRichBolt bolt) { if (hasStatefulBolt && !(bolt instanceof StatefulBoltExecutor)) { bolt = new CheckpointTupleForwarder(bolt); } return bolt; }
protected void init(TopologyContext context, OutputCollector collector) { this.collector = new AnchoringOutputCollector(collector); this.checkPointInputTaskCount = getCheckpointInputTaskCount(context); }
@Override public void execute(Tuple input) { if (CheckpointSpout.isCheckpoint(input)) { processCheckpoint(input); } else { handleTuple(input); } }
Action action = (Action) input.getValueByField(CheckpointSpout.CHECKPOINT_FIELD_ACTION); long txid = input.getLongByField(CheckpointSpout.CHECKPOINT_FIELD_TXID); if (shouldProcessTransaction(action, txid)) { LOG.debug("Processing action {}, txid {}", action, txid); try { if (txid >= lastTxid) { handleCheckpoint(input, action, txid); if (action == CheckPointState.Action.ROLLBACK) { lastTxid = txid - 1;
@Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { init(context, collector); bolt.prepare(stormConf, context, this.collector); }
Action action = (Action) input.getValueByField(CheckpointSpout.CHECKPOINT_FIELD_ACTION); long txid = input.getLongByField(CheckpointSpout.CHECKPOINT_FIELD_TXID); if (shouldProcessTransaction(action, txid)) { LOG.debug("Processing action {}, txid {}", action, txid); try { if (txid >= lastTxid) { handleCheckpoint(input, action, txid); if (action == CheckPointState.Action.ROLLBACK) { lastTxid = txid - 1;
@Override public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) { init(context, collector); bolt.prepare(stormConf, context, this.collector); }
@Override public void execute(Tuple input) { if (CheckpointSpout.isCheckpoint(input)) { processCheckpoint(input); } else { handleTuple(input); } }
protected void init(TopologyContext context, OutputCollector collector) { this.collector = new AnchoringOutputCollector(collector); this.checkPointInputTaskCount = getCheckpointInputTaskCount(context); }
/** * If the topology has at least one stateful bolt all the non-stateful bolts * are wrapped in {@link CheckpointTupleForwarder} so that the checkpoint * tuples can flow through the topology. */ private IRichBolt maybeAddCheckpointTupleForwarder(IRichBolt bolt) { if (hasStatefulBolt && !(bolt instanceof StatefulBoltExecutor)) { bolt = new CheckpointTupleForwarder(bolt); } return bolt; }