原
2017年04月16日 16:21:28
阅读数:412
baseBasicBolt 自带ack 机制
下面是BasicBoltExecutor的一段源码,如果你写的bolt跑出FailedException 异常,basicBolt会调用fail,如果处理成功,会调用ack方法
public void execute(Tuple input) {
_collector.setContext(input);
try {
_bolt.execute(input, _collector);
_collector.getOutputter().ack(input);
} catch(FailedException e) {
if(e instanceof ReportedFailedException) {
_collector.reportError(e);
}
_collector.getOutputter().fail(input);
}
}
本文介绍了Apache Storm中BasicBolt的实现原理及其自带的ack机制。当Bolt执行失败时,BasicBolt会调用fail方法;若执行成功,则调用ack方法确认消息处理完成。
464

被折叠的 条评论
为什么被折叠?



