use of com.alibaba.jstorm.batch.BatchId in project jstorm by alibaba.
the class TransformBolt method execute.
@Override
public void execute(Tuple input, BasicOutputCollector collector) {
BatchId id = (BatchId) input.getValue(0);
long value = rand.nextInt(100);
collector.emit(new Values(id, value));
}
use of com.alibaba.jstorm.batch.BatchId in project jstorm by alibaba.
the class CoordinatedBolt method handlePostCommit.
public void handlePostCommit(Tuple tuple) {
basicCollector.setContext(tuple);
try {
BatchId id = (BatchId) tuple.getValue(0);
((IPostCommit) delegate).postCommit(id, basicCollector);
} catch (Exception e) {
LOG.info("Failed to do postCommit,", e);
}
collector.ack(tuple);
}
use of com.alibaba.jstorm.batch.BatchId in project jstorm by alibaba.
the class CoordinatedBolt method handlePrepareCommit.
public void handlePrepareCommit(Tuple tuple) {
basicCollector.setContext(tuple);
try {
BatchId id = (BatchId) tuple.getValue(0);
((IPrepareCommit) delegate).prepareCommit(id, basicCollector);
collector.ack(tuple);
} catch (FailedException e) {
if (e instanceof ReportedFailedException) {
collector.reportError(e);
}
collector.fail(tuple);
}
}
use of com.alibaba.jstorm.batch.BatchId in project jstorm by alibaba.
the class BatchMetaSpout method execute.
@Override
public void execute(Tuple input, BasicOutputCollector collector) {
String streamId = input.getSourceStreamId();
if (streamId.equals(BatchMetaRebalance.REBALANCE_STREAM_ID)) {
try {
metaClient.rebalanceMqList();
} catch (Exception e) {
LOG.warn("Failed to do rebalance operation", e);
}
} else {
BatchId batchId = (BatchId) input.getValue(0);
emitBatch(batchId, collector);
}
}
use of com.alibaba.jstorm.batch.BatchId in project jstorm by alibaba.
the class SimpleBolt method revert.
@Override
public void revert(BatchId id, byte[] commitResult) {
LOG.info("Receive BatchId " + id);
BatchId failedId = (BatchId) Utils.javaDeserialize(commitResult);
if (!failedId.equals(id)) {
LOG.info("Deserialized error " + id);
}
}
Aggregations