本文整理了Java中org.apache.storm.tuple.Tuple.getMessageId()
方法的一些代码示例,展示了Tuple.getMessageId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tuple.getMessageId()
方法的具体详情如下:
包路径:org.apache.storm.tuple.Tuple
类名称:Tuple
方法名:getMessageId
[英]Gets the message id that associated with this tuple.
[中]获取与此元组关联的消息id。
代码示例来源:origin: apache/storm
@Override
public void resetTimeout(Tuple input) {
Set<Long> roots = input.getMessageId().getAnchors();
for (Long root : roots) {
task.sendUnanchored(Acker.ACKER_RESET_TIMEOUT_STREAM_ID, new Values(root),
executor.getExecutorTransfer(), executor.getPendingEmits());
}
}
代码示例来源:origin: apache/storm
public TupleImpl(Tuple t) {
this.values = t.getValues();
this.taskId = t.getSourceTask();
this.streamId = t.getSourceStreamId();
this.id = t.getMessageId();
this.context = t.getContext();
this.srcComponent = t.getSourceComponent();
try {
TupleImpl ti = (TupleImpl) t;
this._processSampleStartTime = ti._processSampleStartTime;
this._executeSampleStartTime = ti._executeSampleStartTime;
this._outAckVal = ti._outAckVal;
} catch (ClassCastException e) {
// ignore ... if t is not a TupleImpl type .. faster than checking and then casting
}
}
代码示例来源:origin: apache/storm
public byte[] serialize(Tuple tuple) {
try {
_kryoOut.clear();
_kryoOut.writeInt(tuple.getSourceTask(), true);
_kryoOut.writeInt(_ids.getStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId()), true);
tuple.getMessageId().serialize(_kryoOut);
_kryo.serializeInto(tuple.getValues(), _kryoOut);
return _kryoOut.toBytes();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: apache/storm
final Map<Long, Long> anchorsToIds = new HashMap<>();
for (Tuple a : anchors) { // perf critical path. would be nice to avoid iterator allocation here and below
Set<Long> rootIds = a.getMessageId().getAnchorsToIds().keySet();
if (rootIds.size() > 0) {
long edgeId = MessageId.generateId(random);
代码示例来源:origin: apache/storm
@Override
public void ack(Tuple input) {
if (!ackingEnabled) {
return;
}
long ackValue = ((TupleImpl) input).getAckVal();
Map<Long, Long> anchorsToIds = input.getMessageId().getAnchorsToIds();
for (Map.Entry<Long, Long> entry : anchorsToIds.entrySet()) {
task.sendUnanchored(Acker.ACKER_ACK_STREAM_ID,
new Values(entry.getKey(), Utils.bitXor(entry.getValue(), ackValue)),
executor.getExecutorTransfer(), executor.getPendingEmits());
}
long delta = tupleTimeDelta((TupleImpl) input);
if (isDebug) {
LOG.info("BOLT ack TASK: {} TIME: {} TUPLE: {}", taskId, delta, input);
}
if (!task.getUserContext().getHooks().isEmpty()) {
BoltAckInfo boltAckInfo = new BoltAckInfo(input, taskId, delta);
boltAckInfo.applyOn(task.getUserContext());
}
if (delta >= 0) {
executor.getStats().boltAckedTuple(input.getSourceComponent(), input.getSourceStreamId(), delta,
task.getTaskMetrics().getAcked(input.getSourceStreamId()));
}
}
代码示例来源:origin: apache/storm
@Override
public void fail(Tuple input) {
if (!ackingEnabled) {
return;
}
Set<Long> roots = input.getMessageId().getAnchors();
for (Long root : roots) {
task.sendUnanchored(Acker.ACKER_FAIL_STREAM_ID,
new Values(root), executor.getExecutorTransfer(), executor.getPendingEmits());
}
long delta = tupleTimeDelta((TupleImpl) input);
if (isDebug) {
LOG.info("BOLT fail TASK: {} TIME: {} TUPLE: {}", taskId, delta, input);
}
BoltFailInfo boltFailInfo = new BoltFailInfo(input, taskId, delta);
boltFailInfo.applyOn(task.getUserContext());
if (delta >= 0) {
executor.getStats().boltFailedTuple(input.getSourceComponent(), input.getSourceStreamId(), delta,
task.getTaskMetrics().getFailed(input.getSourceStreamId()));
}
}
代码示例来源:origin: apache/ignite
/**
* Transfers data into grid.
*
* @param tuple Storm tuple.
*/
@SuppressWarnings("unchecked")
@Override
public void execute(Tuple tuple) {
if (stopped)
return;
if (!(tuple.getValueByField(igniteTupleField) instanceof Map))
throw new IgniteException("Map as a streamer input is expected!");
final Map<K, V> gridVals = (Map<K, V>)tuple.getValueByField(igniteTupleField);
try {
if (log.isDebugEnabled())
log.debug("Tuple (id:" + tuple.getMessageId() + ") from storm: " + gridVals);
getStreamer().addData(gridVals);
collector.ack(tuple);
}
catch (Exception e) {
log.error("Error while processing tuple of " + gridVals, e);
collector.fail(tuple);
}
}
代码示例来源:origin: org.apache.storm/storm-core
public byte[] serialize(Tuple tuple) {
try {
_kryoOut.clear();
_kryoOut.writeInt(tuple.getSourceTask(), true);
_kryoOut.writeInt(_ids.getStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId()), true);
tuple.getMessageId().serialize(_kryoOut);
_kryo.serializeInto(tuple.getValues(), _kryoOut);
return _kryoOut.toBytes();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!