use of org.apache.storm.trident.topology.TransactionAttempt in project storm by apache.
the class TridentSpoutCoordinator method execute.
@Override
public void execute(Tuple tuple, BasicOutputCollector collector) {
TransactionAttempt attempt = (TransactionAttempt) tuple.getValue(0);
if (tuple.getSourceStreamId().equals(MasterBatchCoordinator.SUCCESS_STREAM_ID)) {
state.cleanupBefore(attempt.getTransactionId());
coord.success(attempt.getTransactionId());
} else {
long txid = attempt.getTransactionId();
Object prevMeta = state.getPreviousState(txid);
Object meta = coord.initializeTransaction(txid, prevMeta, state.getState(txid));
state.overrideState(txid, meta);
collector.emit(MasterBatchCoordinator.BATCH_STREAM_ID, new Values(attempt, meta));
}
}
Aggregations