declarer.addConfiguration(Config.TOPOLOGY_TRANSACTIONAL_ID, _id);
BoltDeclarer emitterDeclarer = 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);
}
for (String id : _bolts.keySet()) {
Component component = _bolts.get(id);
Map<String, SourceArgs> coordinatedArgs = new HashMap<String, SourceArgs>();
// get all source component
for (String c : componentBoltSubscriptions(component)) {
coordinatedArgs.put(c, SourceArgs.all());
}
IdStreamSpec idSpec = null;
if (component.committer) {
idSpec = IdStreamSpec
.makeDetectSpec(
coordinator,
TransactionalSpoutCoordinator.TRANSACTION_COMMIT_STREAM_ID);
}
BoltDeclarer input = builder.setBolt(id, new CoordinatedBolt(
component.bolt, coordinatedArgs, idSpec),
component.parallelism);
for (Map conf : component.componentConfs) {
input.addConfigurations(conf);
}