Search in sources :

Example 1 with BoltAckInfo

use of org.apache.storm.hooks.info.BoltAckInfo in project storm by apache.

the class BoltOutputCollectorImpl method ack.

@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().boltAckedTuple(input.getSourceComponent(), input.getSourceStreamId(), delta);
    }
}
Also used : BoltAckInfo(org.apache.storm.hooks.info.BoltAckInfo) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 BoltAckInfo (org.apache.storm.hooks.info.BoltAckInfo)1 TupleImpl (org.apache.storm.tuple.TupleImpl)1 Values (org.apache.storm.tuple.Values)1