use of com.alibaba.jstorm.task.execute.spout.AckSpoutMsg in project jstorm by alibaba.
the class SpoutExecutors method processTupleEvent.
private Runnable processTupleEvent(Tuple event) {
Runnable runnable = null;
Tuple tuple = (Tuple) event;
if (event.getSourceStreamId().equals(Common.TOPOLOGY_MASTER_CONTROL_STREAM_ID)) {
TopoMasterCtrlEvent ctrlEvent = (TopoMasterCtrlEvent) tuple.getValueByField("ctrlEvent");
if (ctrlEvent.isTransactionEvent()) {
if (spout instanceof ICtrlMsgSpout) {
runnable = new CtrlMsgSpout((ICtrlMsgSpout) spout, ctrlEvent);
}
} else if (ctrlEvent.isFinishInitEvent()) {
LOG.info("spout task-{} received topology finish init operation message", taskId);
taskHbTrigger.updateExecutorStatus(TaskStatus.RUN);
this.checkTopologyFinishInit = true;
} else {
LOG.warn("Received unexpected control event, {}", ctrlEvent);
}
} else if (event.getSourceStreamId().equals(Common.TOPOLOGY_MASTER_REGISTER_METRICS_RESP_STREAM_ID)) {
this.metricsReporter.updateMetricMeta((Map<String, Long>) tuple.getValue(0));
} else {
Object id = tuple.getValue(0);
Object obj = pending.remove((Long) id);
if (obj == null) {
if (JStormDebugger.isDebug(id)) {
LOG.info("Pending map no entry:" + id);
}
runnable = null;
} else {
TupleInfo tupleInfo = (TupleInfo) obj;
String stream_id = tuple.getSourceStreamId();
if (stream_id.equals(Acker.ACKER_ACK_STREAM_ID)) {
runnable = new AckSpoutMsg(id, spout, tuple, tupleInfo, task_stats);
} else if (stream_id.equals(Acker.ACKER_FAIL_STREAM_ID)) {
runnable = new FailSpoutMsg(id, spout, tupleInfo, task_stats);
} else {
LOG.warn("Receive one unknown source Tuple " + idStr);
runnable = null;
}
}
task_stats.recv_tuple(tuple.getSourceComponent(), tuple.getSourceStreamId());
}
return runnable;
}
Aggregations