Search in sources :

Example 1 with CoordinatedBolt

use of com.alibaba.jstorm.batch.impl.CoordinatedBolt in project jstorm by alibaba.

the class BatchTopologyBuilder method setBolt.

public BoltDeclarer setBolt(String id, IBasicBolt bolt, int paralel) {
    CoordinatedBolt coordinatedBolt = new CoordinatedBolt(bolt);
    BoltDeclarer boltDeclarer = topologyBuilder.setBolt(id, coordinatedBolt, paralel);
    if (bolt instanceof IPrepareCommit) {
        boltDeclarer.allGrouping(BatchDef.SPOUT_TRIGGER, BatchDef.PREPARE_STREAM_ID);
    }
    if (bolt instanceof ICommitter) {
        boltDeclarer.allGrouping(BatchDef.SPOUT_TRIGGER, BatchDef.COMMIT_STREAM_ID);
        boltDeclarer.allGrouping(BatchDef.SPOUT_TRIGGER, BatchDef.REVERT_STREAM_ID);
    }
    if (bolt instanceof IPostCommit) {
        boltDeclarer.allGrouping(BatchDef.SPOUT_TRIGGER, BatchDef.POST_STREAM_ID);
    }
    return boltDeclarer;
}
Also used : BoltDeclarer(backtype.storm.topology.BoltDeclarer) CoordinatedBolt(com.alibaba.jstorm.batch.impl.CoordinatedBolt)

Aggregations

BoltDeclarer (backtype.storm.topology.BoltDeclarer)1 CoordinatedBolt (com.alibaba.jstorm.batch.impl.CoordinatedBolt)1