Search in sources :

Example 1 with ReportedFailedException

use of backtype.storm.topology.ReportedFailedException in project jstorm by alibaba.

the class ShellBolt method handleLog.

private void handleLog(ShellMsg shellMsg) {
    String msg = shellMsg.getMsg();
    msg = "ShellLog " + _process.getProcessInfoString() + " " + msg;
    ShellMsg.ShellLogLevel logLevel = shellMsg.getLogLevel();
    switch(logLevel) {
        case TRACE:
            LOG.trace(msg);
            break;
        case DEBUG:
            LOG.debug(msg);
            break;
        case INFO:
            LOG.info(msg);
            break;
        case WARN:
            LOG.warn(msg);
            break;
        case ERROR:
            LOG.error(msg);
            _collector.reportError(new ReportedFailedException(msg));
            break;
        default:
            LOG.info(msg);
            break;
    }
}
Also used : ReportedFailedException(backtype.storm.topology.ReportedFailedException) ShellMsg(backtype.storm.multilang.ShellMsg)

Example 2 with ReportedFailedException

use of backtype.storm.topology.ReportedFailedException in project jstorm by alibaba.

the class CoordinatedBolt method handlePrepareCommit.

public void handlePrepareCommit(Tuple tuple) {
    basicCollector.setContext(tuple);
    try {
        BatchId id = (BatchId) tuple.getValue(0);
        ((IPrepareCommit) delegate).prepareCommit(id, basicCollector);
        collector.ack(tuple);
    } catch (FailedException e) {
        if (e instanceof ReportedFailedException) {
            collector.reportError(e);
        }
        collector.fail(tuple);
    }
}
Also used : IPrepareCommit(com.alibaba.jstorm.batch.IPrepareCommit) ReportedFailedException(backtype.storm.topology.ReportedFailedException) FailedException(backtype.storm.topology.FailedException) ReportedFailedException(backtype.storm.topology.ReportedFailedException) BatchId(com.alibaba.jstorm.batch.BatchId)

Aggregations

ReportedFailedException (backtype.storm.topology.ReportedFailedException)2 ShellMsg (backtype.storm.multilang.ShellMsg)1 FailedException (backtype.storm.topology.FailedException)1 BatchId (com.alibaba.jstorm.batch.BatchId)1 IPrepareCommit (com.alibaba.jstorm.batch.IPrepareCommit)1