Search in sources :

Example 1 with BatchStatus

use of com.alibaba.jstorm.batch.util.BatchStatus in project jstorm by alibaba.

the class BatchSpoutMsgId method mkInstance.

public static BatchSpoutMsgId mkInstance() {
    BatchId batchId = BatchId.mkInstance();
    BatchStatus batchStatus = BatchStatus.COMPUTING;
    return new BatchSpoutMsgId(batchId, batchStatus);
}
Also used : BatchId(com.alibaba.jstorm.batch.BatchId) BatchStatus(com.alibaba.jstorm.batch.util.BatchStatus)

Example 2 with BatchStatus

use of com.alibaba.jstorm.batch.util.BatchStatus in project jstorm by alibaba.

the class BatchSpoutTrigger method handleFail.

protected void handleFail(BatchSpoutMsgId msgId) {
    LOG.info("Failed batch " + msgId);
    BatchStatus status = msgId.getBatchStatus();
    BatchStatus newStatus = status.error();
    if (newStatus == BatchStatus.ERROR) {
        // create new status
        mkMsgId(msgId);
    } else {
        msgId.setBatchStatus(newStatus);
        batchQueue.offer(msgId);
    }
}
Also used : BatchStatus(com.alibaba.jstorm.batch.util.BatchStatus)

Example 3 with BatchStatus

use of com.alibaba.jstorm.batch.util.BatchStatus in project jstorm by alibaba.

the class BatchSpoutTrigger method forward.

protected void forward(BatchSpoutMsgId msgId) {
    BatchStatus status = msgId.getBatchStatus();
    BatchStatus newStatus = status.forward();
    if (newStatus == null) {
        // create new status
        mkMsgId(msgId);
        LOG.info("Finish old batch " + msgId);
    } else {
        msgId.setBatchStatus(newStatus);
        batchQueue.offer(msgId);
        LOG.info("Forward batch " + msgId);
    }
}
Also used : BatchStatus(com.alibaba.jstorm.batch.util.BatchStatus)

Aggregations

BatchStatus (com.alibaba.jstorm.batch.util.BatchStatus)3 BatchId (com.alibaba.jstorm.batch.BatchId)1