org.apache.camel.spi.ExceptionHandler.handleException()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中org.apache.camel.spi.ExceptionHandler.handleException()方法的一些代码示例,展示了ExceptionHandler.handleException()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExceptionHandler.handleException()方法的具体详情如下:
包路径:org.apache.camel.spi.ExceptionHandler
类名称:ExceptionHandler
方法名:handleException

ExceptionHandler.handleException介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

if (cx.targetException().equals(ec)) {
 ExceptionHandler h = cx.targetCatchHandler().newInstance();
 h.handleException(e);
 break;

代码示例来源:origin: com.bluelock/camel-spring-amqp

@Override
  public void handleError(Throwable t) {
    if(t instanceof AmqpConnectException) {
      LOG.error("AMQP Connection error, marking this connection as failed");
      onClose(null);
    }
    
    getExceptionHandler().handleException(t);
  }
};

代码示例来源:origin: Bluelock/camel-spring-amqp

@Override
  public void handleError(Throwable t) {
    if(t instanceof AmqpConnectException) {
      LOG.error("AMQP Connection error, marking this connection as failed");
      onClose(null);
    }
    
    getExceptionHandler().handleException(t);
  }
};

代码示例来源:origin: org.apache.camel/camel-stream

public void run() {
  try {
    readFromStream();
  } catch (InterruptedException e) {
    // we are closing down so ignore
  } catch (Exception e) {
    getExceptionHandler().handleException(e);
  }
}

代码示例来源:origin: org.apache.camel/camel-netty4

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
  // only close if we are still allowed to run
  if (consumer.isRunAllowed()) {
    // let the exception handler deal with it
    consumer.getExceptionHandler().handleException("Closing channel as an exception was thrown from Netty", cause);
    // close channel in case an exception was thrown
    NettyHelper.close(ctx.channel());
  }
}

代码示例来源:origin: org.apache.camel/camel-kubernetes

@Override
public void eventReceived(io.fabric8.kubernetes.client.Watcher.Action action, HorizontalPodAutoscaler resource) {
  HPAEvent hpae = new HPAEvent(action, resource);
  Exchange exchange = getEndpoint().createExchange();
  exchange.getIn().setBody(hpae.getHpa());
  exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION, hpae.getAction());
  exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_TIMESTAMP, System.currentTimeMillis());
  try {
    processor.process(exchange);
  } catch (Exception e) {
    getExceptionHandler().handleException("Error during processing", exchange, e);
  }
}

代码示例来源:origin: org.apache.camel/camel-kubernetes

@Override
public void eventReceived(io.fabric8.kubernetes.client.Watcher.Action action,
  ReplicationController resource) {
  ReplicationControllerEvent rce = new ReplicationControllerEvent(action, resource);
  Exchange exchange = getEndpoint().createExchange();
  exchange.getIn().setBody(rce.getReplicationController());
  exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION, rce.getAction());
  exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_EVENT_TIMESTAMP, System.currentTimeMillis());
  try {
    processor.process(exchange);
  } catch (Exception e) {
    getExceptionHandler().handleException("Error during processing", exchange, e);
  }
}

代码示例来源:origin: org.apache.camel/camel-pubnub

@Override
public void message(PubNub pubnub, PNMessageResult message) {
  Exchange exchange = endpoint.createExchange();
  Message inmessage = exchange.getIn();
  inmessage.setBody(message);
  inmessage.setHeader(TIMETOKEN, message.getTimetoken());
  inmessage.setHeader(CHANNEL, message.getChannel());
  try {
    getProcessor().process(exchange);
  } catch (Exception e) {
    getExceptionHandler().handleException("Error processing exchange", exchange, e);
  }
}

代码示例来源:origin: org.apache.camel/camel-undertow

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange,
          exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-undertow

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-atmosphere-websocket

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-atmosphere-websocket

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-ahc-ws

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-websocket

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-atmosphere-websocket

public void done(boolean doneSync) {
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
});

代码示例来源:origin: org.apache.camel/camel-netty

@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent exceptionEvent) throws Exception {
  // only close if we are still allowed to run
  if (consumer.isRunAllowed()) {
    // let the exception handler deal with it
    consumer.getExceptionHandler().handleException("Closing channel as an exception was thrown from Netty", exceptionEvent.getCause());
    // close channel in case an exception was thrown
    NettyHelper.close(exceptionEvent.getChannel());
  }
}

代码示例来源:origin: io.rhiot/camel-pi4j

private void sendEvent(Exchange exchange) {
  try {
    getProcessor().process(exchange);
  } catch (Exception e) {
    exchange.setException(e);
  } finally {
    // log exception if an exception occurred and was not handled
    if (exchange.getException() != null) {
      getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
    }
  }
}

代码示例来源:origin: org.apache.camel/camel-netty4

private void processSynchronously(final Exchange exchange, final ChannelHandlerContext ctx, final Object message) {
  try {
    consumer.getProcessor().process(exchange);
    if (consumer.getConfiguration().isSync()) {
      sendResponse(message, ctx, exchange);
    }
  } catch (Throwable e) {
    consumer.getExceptionHandler().handleException(e);
  } finally {
    consumer.doneUoW(exchange);
  }
}

代码示例来源:origin: org.apache.camel/camel-netty

private void processSynchronously(final Exchange exchange, final MessageEvent messageEvent) {
  try {
    consumer.getProcessor().process(exchange);
    if (consumer.getConfiguration().isSync()) {
      sendResponse(messageEvent, exchange);
    }
  } catch (Throwable e) {
    consumer.getExceptionHandler().handleException(e);
  } finally {
    consumer.doneUoW(exchange);
  }
}

代码示例来源:origin: io.fabric8.ipaas.apps/fabric8mq

@Override
public void intercept(MessageRouter messageRouter, CommandMessage message) {
  Exchange exchange = getEndpoint().createExchange(ExchangePattern.InOnly);
  exchange.setIn(message);
  try {
    getProcessor().process(exchange);
  } catch (Exception e) {
    exchange.setException(e);
  }
  if (exchange.getException() != null) {
    getExceptionHandler().handleException("Error processing intercepted message: " + message, exchange, exchange.getException());
  }
}

相关文章