Search in sources :

Example 1 with SpoutAckInfo

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

the class SpoutExecutor method ackSpoutMsg.

public void ackSpoutMsg(Executor executor, Task taskData, Long timeDelta, TupleInfo tupleInfo) {
    try {
        ISpout spout = (ISpout) taskData.getTaskObject();
        int taskId = taskData.getTaskId();
        if (executor.getIsDebug()) {
            LOG.info("SPOUT Acking message {} {}", tupleInfo.getId(), tupleInfo.getMessageId());
        }
        spout.ack(tupleInfo.getMessageId());
        new SpoutAckInfo(tupleInfo.getMessageId(), taskId, timeDelta).applyOn(taskData.getUserContext());
        if (timeDelta != null) {
            ((SpoutExecutorStats) executor.getStats()).spoutAckedTuple(tupleInfo.getStream(), timeDelta);
        }
    } catch (Exception e) {
        throw Utils.wrapInRuntime(e);
    }
}
Also used : SpoutExecutorStats(org.apache.storm.stats.SpoutExecutorStats) ISpout(org.apache.storm.spout.ISpout) SpoutAckInfo(org.apache.storm.hooks.info.SpoutAckInfo)

Example 2 with SpoutAckInfo

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

the class SpoutExecutor method ackSpoutMsg.

public void ackSpoutMsg(SpoutExecutor executor, Task taskData, Long timeDelta, TupleInfo tupleInfo) {
    try {
        ISpout spout = (ISpout) taskData.getTaskObject();
        int taskId = taskData.getTaskId();
        if (executor.getIsDebug()) {
            LOG.info("SPOUT Acking message {} {}", tupleInfo.getRootId(), tupleInfo.getMessageId());
        }
        spout.ack(tupleInfo.getMessageId());
        if (!taskData.getUserContext().getHooks().isEmpty()) {
            // avoid allocating SpoutAckInfo obj if not necessary
            new SpoutAckInfo(tupleInfo.getMessageId(), taskId, timeDelta).applyOn(taskData.getUserContext());
        }
        if (hasAckers && timeDelta != null) {
            executor.getStats().spoutAckedTuple(tupleInfo.getStream(), timeDelta);
            taskData.getTaskMetrics().spoutAckedTuple(tupleInfo.getStream(), timeDelta);
        }
    } catch (Exception e) {
        throw Utils.wrapInRuntime(e);
    }
}
Also used : ISpout(org.apache.storm.spout.ISpout) SpoutAckInfo(org.apache.storm.hooks.info.SpoutAckInfo)

Aggregations

SpoutAckInfo (org.apache.storm.hooks.info.SpoutAckInfo)2 ISpout (org.apache.storm.spout.ISpout)2 SpoutExecutorStats (org.apache.storm.stats.SpoutExecutorStats)1