Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Exception 如何告诉camel在某些业务逻辑上重新提交?_Exception_Soap_Cxf_Apache Camel - Fatal编程技术网

Exception 如何告诉camel在某些业务逻辑上重新提交?

Exception 如何告诉camel在某些业务逻辑上重新提交?,exception,soap,cxf,apache-camel,Exception,Soap,Cxf,Apache Camel,我想知道如何让camel根据业务逻辑重新传递我的消息 我的路由正在调用soap端点,根据服务器返回的消息,我需要在几秒钟内安排重试 基本上,我配置了这种错误处理: onException(Throwable.class) .handled(true) .processRef("exceptionHandler") .redeliveryDelay(5000) .maximumRedeliveries(1) .to("file:// Myexception

我想知道如何让camel根据业务逻辑重新传递我的消息

我的路由正在调用soap端点,根据服务器返回的消息,我需要在几秒钟内安排重试

基本上,我配置了这种错误处理:

onException(Throwable.class)
    .handled(true)
    .processRef("exceptionHandler")
    .redeliveryDelay(5000)
    .maximumRedeliveries(1)
    .to("file://
My
exceptionHandler
检查异常是否是SOAP错误,将其解组,并根据计划重试所需的内容来确定


在camel中有这样做的方法吗?

好吧,最后,我的解决方案是:

from("...")
    .doTry()
        .to("...")
    .doCatch(Exception.class)
         .beanRef("handleException")
    .end()
    .beanRef("handleRegularResponse");
处理器
handleException
处理异常,尝试理解问题,然后抛出更精确的异常。在我的例子中,它可以抛出两种类型的异常:不需要重新传递的FunctionalException和我将在几分钟内尝试重新传递的TechnicalException

然后,我必须为该特定异常声明一个错误处理程序:

onException(TechnicalException.class)
    .handled(true)
    .redeliveryPolicyRef("...")
    .useOriginalMessage();
HIH

您可以使用onWhen(谓词)并实现逻辑来返回true或false。