use of backtype.storm.tuple.TupleImplExt in project jstorm by alibaba.
the class TaskHeartbeatTrigger method sendHbMsg.
//taskheartbeat send control message
public void sendHbMsg() {
if (componentId.equals(Common.TOPOLOGY_MASTER_COMPONENT_ID)) {
Values values = new Values(uptime.uptime(), executorStatus.getStatus());
TupleExt tuple = new TupleImplExt(sysTopologyCtx, values, taskId, Common.TOPOLOGY_MASTER_HB_STREAM_ID);
queue.publish(tuple);
} else {
// Send task heartbeat to topology master
List values = JStormUtils.mk_list(uptime.uptime(), executorStatus.getStatus());
if (spoutCollector != null) {
spoutCollector.emitCtrl(Common.TOPOLOGY_MASTER_HB_STREAM_ID, values, null);
} else if (boltCollector != null) {
boltCollector.emitCtrl(Common.TOPOLOGY_MASTER_HB_STREAM_ID, null, values);
} else {
LOG.warn("Failed to send hearbeat msg. OutputCollector has not been initialized!");
}
}
}
use of backtype.storm.tuple.TupleImplExt in project jstorm by alibaba.
the class SpoutCollector method sendCtrlMsg.
protected List<Integer> sendCtrlMsg(String out_stream_id, List<Object> values, Object message_id, Integer out_task_id) {
final long startTime = emitTotalTimer.getTime();
try {
boolean needAck = (message_id != null) && (ackerNum > 0);
Long root_id = getRootId(message_id);
java.util.List<Integer> out_tasks = null;
if (out_task_id != null) {
out_tasks = sendTargets.get(out_task_id, out_stream_id, values, null, root_id);
} else {
out_tasks = sendTargets.get(out_stream_id, values, null, root_id);
}
List<Long> ackSeq = new ArrayList<Long>();
for (Integer t : out_tasks) {
MessageId msgid;
if (needAck) {
// Long as = MessageId.generateId();
Long as = MessageId.generateId(random);
msgid = MessageId.makeRootId(root_id, as);
ackSeq.add(as);
} else {
msgid = null;
}
TupleImplExt tp = new TupleImplExt(topology_context, values, task_id, out_stream_id, msgid);
tp.setTargetTaskId(t);
transferCtr(tp);
}
sendMsgToAck(out_stream_id, values, message_id, root_id, ackSeq, needAck);
return out_tasks;
} finally {
emitTotalTimer.updateTime(startTime);
}
}
Aggregations