Buggy code:
public class TridentTopologyBuilder { Map < GlobalStreamId , String > _batchIds = new HashMap ( ) ; Map < String , TridentTopologyBuilder . TransactionalSpoutComponent > _spouts = new HashMap ( ) ; Map < String , TridentTopologyBuilder . SpoutComponent > _batchPerTupleSpouts = new HashMap ( ) ; Map < String , TridentTopologyBuilder . Component > _bolts = new HashMap ( ) ; public SpoutDeclarer setBatchPerTupleSpout ( String id , String streamName , IRichSpout spout , Integer parallelism , String batchGroup ) { } public SpoutDeclarer setSpout ( String id , String streamName , String txStateId , IBatchSpout spout , Integer parallelism , String batchGroup ) { } public SpoutDeclarer setSpout ( String id , String streamName , String txStateId , ITridentSpout spout , Integer parallelism , String batchGroup ) { } public BoltDeclarer setBolt ( String id , ITridentBatchBolt bolt , Integer parallelism , Set < String > committerBatches , Map < String , String > batchGroups ) { } String masterCoordinator ( String batchGroup ) { } static final String SPOUT_COORD_PREFIX = "$spoutcoord-" ; public static String spoutCoordinator ( String spoutId ) { } public static String spoutIdFromCoordinatorId ( String coordId ) { } Map < GlobalStreamId , String > fleshOutStreamBatchIds ( boolean includeCommitStream ) { } public StormTopology buildTopology ( ) { TopologyBuilder builder = new TopologyBuilder ( ) ; Map < GlobalStreamId , String > batchIdsForSpouts = fleshOutStreamBatchIds ( false ) ; Map < GlobalStreamId , String > batchIdsForBolts = fleshOutStreamBatchIds ( true ) ; Map < String , List < String > > batchesToCommitIds = new HashMap < String , List < String > > ( ) ; Map < String , List < ITridentSpout > > batchesToSpouts = new HashMap < String , List < ITridentSpout > > ( ) ; for ( String id : _spouts . keySet ( ) ) { TridentTopologyBuilder . TransactionalSpoutComponent c = _spouts . get ( id ) ; if ( ( c . spout ) instanceof IRichSpout ) { builder . setSpout ( id , ( ( IRichSpout ) ( c . spout ) ) , c . parallelism ) ; } else { String batchGroup = c . batchGroupId ; if ( ! ( batchesToCommitIds . containsKey ( batchGroup ) ) ) { batchesToCommitIds . put ( batchGroup , new ArrayList < String > ( ) ) ; } batchesToCommitIds . get ( batchGroup ) . add ( c . commitStateId ) ; if ( ! ( batchesToSpouts . containsKey ( batchGroup ) ) ) { batchesToSpouts . put ( batchGroup , new ArrayList < ITridentSpout > ( ) ) ; } batchesToSpouts . get ( batchGroup ) . add ( ( ( ITridentSpout ) ( c . spout ) ) ) ; BoltDeclarer scd = builder . setBolt ( TridentTopologyBuilder . spoutCoordinator ( id ) , new TridentSpoutCoordinator ( c . commitStateId , ( ( ITridentSpout ) ( c . spout ) ) ) ) . globalGrouping ( masterCoordinator ( c . batchGroupId ) , BATCH_STREAM_ID ) . globalGrouping ( masterCoordinator ( c . batchGroupId ) , SUCCESS_STREAM_ID ) ; for ( Map m : c . componentConfs ) { scd . addConfigurations ( m ) ; } Map < String , TridentBoltExecutor . CoordSpec > specs = new HashMap ( ) ; specs . put ( c . batchGroupId , new CoordSpec ( ) ) ; BoltDeclarer bd = builder . setBolt ( id , new TridentBoltExecutor ( new TridentSpoutExecutor ( c . commitStateId , c . streamName , ( ( ITridentSpout ) ( c . spout ) ) ) , batchIdsForSpouts , specs ) , c . parallelism ) ; bd . allGrouping ( TridentTopologyBuilder . spoutCoordinator ( id ) , BATCH_STREAM_ID ) ; bd . allGrouping ( masterCoordinator ( batchGroup ) , SUCCESS_STREAM_ID ) ; if ( ( c . spout ) instanceof ICommitterTridentSpout ) { bd . allGrouping ( masterCoordinator ( batchGroup ) , COMMIT_STREAM_ID ) ; } for ( Map m : c . componentConfs ) { <START_BUG> bd . addConfigurations ( m ) ; <END_BUG> } } } for ( String id : _batchPerTupleSpouts . keySet ( ) ) { TridentTopologyBuilder . SpoutComponent c = _batchPerTupleSpouts . get ( id ) ; SpoutDeclarer d = builder . setSpout ( id , new RichSpoutBatchTriggerer ( ( ( IRichSpout ) ( c . spout ) ) , c . streamName , c . batchGroupId ) , c . parallelism ) ; for ( Map conf : c . componentConfs ) { d . addConfigurations ( conf ) ; } } for ( String batch : batchesToCommitIds . keySet ( ) ) { List < String > commitIds = batchesToCommitIds . get ( batch ) ; builder . setSpout ( masterCoordinator ( batch ) , new MasterBatchCoordinator ( commitIds , batchesToSpouts . get ( batch ) ) ) ; } for ( String id : _bolts . keySet ( ) ) { TridentTopologyBuilder . Component c = _bolts . get ( id ) ; Map < String , CoordSpec > specs = new HashMap ( ) ; for ( GlobalStreamId s : getBoltSubscriptionStreams ( id ) ) { String batch = batchIdsForBolts . get ( s ) ; if ( ! ( specs . containsKey ( batch ) ) ) specs . put ( batch , new CoordSpec ( ) ) ; CoordSpec spec = specs . get ( batch ) ; CoordType ct ; if ( _batchPerTupleSpouts . containsKey ( s . get_componentId ( ) ) ) { ct = CoordType . single ( ) ; } else { ct = CoordType . all ( ) ; } spec . coords . put ( s . get_componentId ( ) , ct ) ; } for ( String b : c . committerBatches ) { specs . get ( b ) . commitStream = new GlobalStreamId ( masterCoordinator ( b ) , MasterBatchCoordinator . COMMIT_STREAM_ID ) ; }

Fix:
scd . addConfigurations ( m ) ;