Java Code Examples for org.apache.storm.task.OutputCollector#reportError()

The following examples show how to use org.apache.storm.task.OutputCollector#reportError() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DBusRouterStatBolt.java    From DBus with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
    try {
        this.context = context;
        this.collector = collector;
        this.statWindows = new StatWindows(true);
        this.encodeBoltTaskIdSum = computeTaskIdsSum(context.getComponentTasks("RouterEncodeBolt"));
        this.inner = new DBusRouterStatBoltInner(conf);
        this.cache = new PerpetualCache("stat_cache");
        init();
        logger.info("stat bolt init completed.");
    } catch (Exception e) {
        logger.error("stat bolt init error.", e);
        collector.reportError(e);
    }
}
 
Example 2
Source File: SinkerWriteBolt.java    From DBus with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
    try {
        this.context = context;
        this.collector = collector;
        inner = new SinkerBaseMap(conf);
        init();
        logger.info("[write bolt] init completed.");
    } catch (Exception e) {
        logger.error("[write bolt] init error.", e);
        collector.reportError(e);
    }
}
 
Example 3
Source File: DBusRouterEncodeBolt.java    From DBus with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
    try {
        this.context = context;
        this.collector = collector;
        statWindows = new StatWindows();
        inner = new DBusRouterEncodeBoltInner(conf);
        init(false);
        logger.info("encode bolt init completed.");
    } catch (Exception e) {
        logger.error("encode bolt init error.", e);
        collector.reportError(e);
    }
}
 
Example 4
Source File: DBusRouterKafkaWriteBolt.java    From DBus with Apache License 2.0 5 votes vote down vote up
@Override
public void prepare(Map conf, TopologyContext context, OutputCollector collector) {
    try {
        this.context = context;
        this.collector = collector;
        inner = new DBusRouterKafkaWriteBoltInner(conf);
        init();
        logger.info("kafka write bolt init completed.");
    } catch (Exception e) {
        logger.error("kafka write bolt init error.", e);
        collector.reportError(e);
    }
}
 
Example 5
Source File: StormErrorUtils.java    From metron with Apache License 2.0 5 votes vote down vote up
/**
 * Handles a {@link MetronError} that occurs.
 *
 * @param collector The Storm output collector being reported to
 * @param error The error that occurred
 */
public static void handleError(OutputCollector collector, MetronError error)
{
  collector.emit(Constants.ERROR_STREAM, new Values(error.getJSONObject()));
  Optional<Throwable> throwable = error.getThrowable();
  if (throwable.isPresent()) {
    collector.reportError(throwable.get());
  }

}