Exception 如何告诉camel在某些业务逻辑上重新提交?
我想知道如何让camel根据业务逻辑重新传递我的消息 我的路由正在调用soap端点,根据服务器返回的消息,我需要在几秒钟内安排重试 基本上,我配置了这种错误处理: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
onException(Throwable.class)
.handled(true)
.processRef("exceptionHandler")
.redeliveryDelay(5000)
.maximumRedeliveries(1)
.to("file://
MyexceptionHandler
检查异常是否是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。