Search in sources :

Example 1 with TransactionStatefulBolt

use of com.alibaba.jstorm.transactional.bolt.TransactionStatefulBolt in project jstorm by alibaba.

the class TransactionTopologyBuilder method setBolt.

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;
}
Also used : IRichBolt(backtype.storm.topology.IRichBolt) TransactionBolt(com.alibaba.jstorm.transactional.bolt.TransactionBolt) TransactionStatefulBolt(com.alibaba.jstorm.transactional.bolt.TransactionStatefulBolt) ITransactionBoltExecutor(com.alibaba.jstorm.transactional.bolt.ITransactionBoltExecutor) BoltDeclarer(backtype.storm.topology.BoltDeclarer) ITransactionStatefulBoltExecutor(com.alibaba.jstorm.transactional.bolt.ITransactionStatefulBoltExecutor)

Aggregations

BoltDeclarer (backtype.storm.topology.BoltDeclarer)1 IRichBolt (backtype.storm.topology.IRichBolt)1 ITransactionBoltExecutor (com.alibaba.jstorm.transactional.bolt.ITransactionBoltExecutor)1 ITransactionStatefulBoltExecutor (com.alibaba.jstorm.transactional.bolt.ITransactionStatefulBoltExecutor)1 TransactionBolt (com.alibaba.jstorm.transactional.bolt.TransactionBolt)1 TransactionStatefulBolt (com.alibaba.jstorm.transactional.bolt.TransactionStatefulBolt)1