Search in sources :

Example 1 with SpoutFailInfo

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

the class SpoutExecutor method failSpoutMsg.

public void failSpoutMsg(SpoutExecutor executor, Task taskData, Long timeDelta, TupleInfo tupleInfo, String reason) {
    try {
        ISpout spout = (ISpout) taskData.getTaskObject();
        int taskId = taskData.getTaskId();
        if (executor.getIsDebug()) {
            LOG.info("SPOUT Failing {} : {} REASON: {}", tupleInfo.getRootId(), tupleInfo, reason);
        }
        spout.fail(tupleInfo.getMessageId());
        new SpoutFailInfo(tupleInfo.getMessageId(), taskId, timeDelta).applyOn(taskData.getUserContext());
        if (timeDelta != null) {
            executor.getStats().spoutFailedTuple(tupleInfo.getStream());
            taskData.getTaskMetrics().spoutFailedTuple(tupleInfo.getStream());
        }
    } catch (Exception e) {
        throw Utils.wrapInRuntime(e);
    }
}
Also used : SpoutFailInfo(org.apache.storm.hooks.info.SpoutFailInfo) ISpout(org.apache.storm.spout.ISpout)

Example 2 with SpoutFailInfo

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

the class SpoutExecutor method failSpoutMsg.

public void failSpoutMsg(Executor executor, Task taskData, Long timeDelta, TupleInfo tupleInfo, String reason) {
    try {
        ISpout spout = (ISpout) taskData.getTaskObject();
        int taskId = taskData.getTaskId();
        if (executor.getIsDebug()) {
            LOG.info("SPOUT Failing {} : {} REASON: {}", tupleInfo.getId(), tupleInfo, reason);
        }
        spout.fail(tupleInfo.getMessageId());
        new SpoutFailInfo(tupleInfo.getMessageId(), taskId, timeDelta).applyOn(taskData.getUserContext());
        if (timeDelta != null) {
            ((SpoutExecutorStats) executor.getStats()).spoutFailedTuple(tupleInfo.getStream(), timeDelta);
        }
    } catch (Exception e) {
        throw Utils.wrapInRuntime(e);
    }
}
Also used : SpoutExecutorStats(org.apache.storm.stats.SpoutExecutorStats) SpoutFailInfo(org.apache.storm.hooks.info.SpoutFailInfo) ISpout(org.apache.storm.spout.ISpout)

Aggregations

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