@Override public BoltDeclarer setBolt(String id, IRichBolt bolt, Number parallelismHint) throws IllegalArgumentException{ upToDownstreamComponentsMap.put(id, new HashSet<String>()); validateUnusedId(id); IRichBolt boltExecutor; boolean isStatefulBolt = false; if (bolt instanceof ITransactionStatefulBoltExecutor) { isStatefulBolt = true; boltExecutor = new TransactionStatefulBolt((ITransactionStatefulBoltExecutor) bolt); } else { boltExecutor = new TransactionBolt((ITransactionBoltExecutor) bolt); } initCommon(id, boltExecutor, parallelismHint); _bolts.put(id, boltExecutor); BoltDeclarer ret = new TransactionBoltDeclarer(id); ret.addConfiguration(TransactionCommon.TRANSACTION_STATEFUL_BOLT, isStatefulBolt); // If using KvState bolt, the corresponding init operater would be registered here. if (bolt instanceof KvStatefulBoltExecutor) { ConfigExtension.registerTransactionTaskStateInitOp(TopologyBuilder.getStormConf(), id, KeyRangeStateTaskInit.class); } return ret; }
builder.setBolt(_spoutId, new CoordinatedBolt(new TransactionalSpoutBatchExecutor(_spout), null, null), _spoutParallelism) .allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_BATCH_STREAM_ID) .addConfiguration(Config.TOPOLOGY_TRANSACTIONAL_ID, _id); if (_spout instanceof ICommitterTransactionalSpout) { emitterDeclarer.allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_COMMIT_STREAM_ID);
_spoutParallelism) .allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_BATCH_STREAM_ID) .addConfiguration(Config.TOPOLOGY_TRANSACTIONAL_ID, _id); if(_spout instanceof ICommitterTransactionalSpout) { emitterDeclarer.allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_COMMIT_STREAM_ID);
.addConfiguration(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, 3); } else {
builder.setBolt(_spoutId, new CoordinatedBolt(new TransactionalSpoutBatchExecutor(_spout), null, null), _spoutParallelism) .allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_BATCH_STREAM_ID) .addConfiguration(Config.TOPOLOGY_TRANSACTIONAL_ID, _id); if (_spout instanceof ICommitterTransactionalSpout) { emitterDeclarer.allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_COMMIT_STREAM_ID);
void configureTickFrequency(Configuration boltConf, BoltDeclarer boltDeclarer) { String tickFrequency = boltConf.getString(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS.replaceAll("\\.", "..")); if (StringUtils.isNotBlank(tickFrequency)) { boltDeclarer.addConfiguration(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, tickFrequency); } }
_spoutParallelism) .allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_BATCH_STREAM_ID) .addConfiguration(Config.TOPOLOGY_TRANSACTIONAL_ID, _id); if(_spout instanceof ICommitterTransactionalSpout) { emitterDeclarer.allGrouping(coordinator, TransactionalSpoutCoordinator.TRANSACTION_COMMIT_STREAM_ID);
public BoltDeclarer setBolt(String id, ITransactionBoltExecutor bolt, Number parallelism_hint) { upToDownstreamComponentsMap.put(id, new HashSet<String>()); validateUnusedId(id); IRichBolt boltExecutor; boolean isStatefulBolt = false; if (bolt instanceof ITransactionStatefulBoltExecutor) { isStatefulBolt = true; boltExecutor = new TransactionStatefulBolt((ITransactionStatefulBoltExecutor) bolt); } else { boltExecutor = new TransactionBolt((ITransactionBoltExecutor) bolt); } initCommon(id, boltExecutor, parallelism_hint); _bolts.put(id, boltExecutor); BoltDeclarer ret = new TransactionBoltDeclarer(id); ret.addConfiguration(TransactionCommon.TRANSACTION_STATEFUL_BOLT, isStatefulBolt); return ret; }
boltDeclarer.addConfiguration( componentProperty.getKey(), componentProperty.getValue());