use of com.alibaba.jstorm.transactional.BatchGroupId in project jstorm by alibaba.
the class TransactionOutputCollector method flushBarrier.
public void flushBarrier() {
// flush pending message in outputCollector
flush();
// Emit and flush barrier message to all downstream tasks
for (Entry<Integer, CountValue> entry : currBatchTracker.sendMsgCount.entrySet()) {
int taskId = entry.getKey();
CountValue count = entry.getValue();
BatchSnapshot snapshot = new BatchSnapshot(currBatchTracker.getBatchGroupId(), count.count);
emitDirectByDelegate(taskId, TransactionCommon.BARRIER_STREAM_ID, null, new Values(new BatchGroupId(currBatchTracker.getBatchGroupId()), snapshot), null);
count.count = 0;
}
flush();
}
use of com.alibaba.jstorm.transactional.BatchGroupId in project jstorm by alibaba.
the class TransactionOutputCollector method emitDirect.
@Override
public void emitDirect(int taskId, String streamId, Collection<Tuple> anchors, List<Object> tuple, ICollectorCallback callback) {
List<Object> tupleWithId = new ArrayList<Object>();
tupleWithId.add(new BatchGroupId(currBatchTracker.getBatchGroupId()));
tupleWithId.addAll(tuple);
delegate.emitDirect(taskId, streamId, anchors, tupleWithId, callback);
}
use of com.alibaba.jstorm.transactional.BatchGroupId in project jstorm by alibaba.
the class TransactionStatefulBolt method rollback.
@Override
protected void rollback(TransactionState state) {
LOG.info("Start to rollback, state={}, currentBatchStatus={}", state, currentBatchStatusInfo());
boltExecutor.rollBack(Utils.maybe_deserialize((byte[]) state.getUserCheckpoint()));
BatchGroupId batchGroupId = state.getCurrBatchGroupId();
lastSuccessfulBatch.put(batchGroupId.groupId, batchGroupId.batchId);
cleanupBuffer(state.getCurrBatchGroupId().groupId);
}
Aggregations