在处理器上设置不同的交换异常

发布于 2024-11-25 08:54:04 字数 533 浏览 0 评论 0原文

我有这样的路线:

onException(classOf[RuntimeException]).process(runtimeProcessor).process(doSmth).log(LoggingLevel.INFO, "new", "${exchangeId} --- ${exception.stacktrace} ") 

在处理器上我这样做:

 CustomException customException =new CustomException () 
    exchange.setException(customException ) 
    exchange.getOut.setBody(doc)

现在的问题是,在这个处理器之后,它不会转到其他处理器(即在我的情况下,它不会转到“doSmth”处理器)

我猜这种行为是我已经更改了交换上的异常,我在其上构建了“onException”。

即使在更改了交易所的例外之后,有没有什么方法可以强制继续我的路线!

I have a route like that :

onException(classOf[RuntimeException]).process(runtimeProcessor).process(doSmth).log(LoggingLevel.INFO, "new", "${exchangeId} --- ${exception.stacktrace} ") 

On the processor I do :

 CustomException customException =new CustomException () 
    exchange.setException(customException ) 
    exchange.getOut.setBody(doc)

The issue now that after this processor , it doesn't go to other processors (i.e. in my case , it doesn't go to "doSmth" processor )

I guess that behavior is that I have changed the exception on the exchange that I have built my "onException" over it .

Is there any way to force to go on my route even after changing the Exchange's exception !!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2024-12-02 08:54:04

我试图将进入交换的捕获的异常包装到另一个自定义异常中。

包装之后,我需要将此异常设置到自定义交换中。
后来我从camel论坛上的@Claus Ibsen-2那里发现Camel不会继续。当我使用路由时,

exchange.setException(ex)

我已经设法通过执行以下@处理器来完成一些工作:

exchange.getOut.setHeader("ex",customException) 

然后@Route:

this.onException(classOf[IOException]).process(doSmth).log(LoggingLevel.INFO, "new", ${in.header.ex} ") 

它将以下内容打印到我的日志中,以及我从一开始就真正需要的内容:
自定义异常:java.lang.IOException

I was trying to wrap the caught exception that comes into the exchage and wrap it into another custom exception .

After this wrapping I need to set this exception into a custom exchange .
I have discoverd later from @Claus Ibsen-2 on the camel forum that Camel won't cont. routing when I use

exchange.setException(ex)

I have managed to do some work around by doing the following @ processor :

exchange.getOut.setHeader("ex",customException) 

then @Route :

this.onException(classOf[IOException]).process(doSmth).log(LoggingLevel.INFO, "new", ${in.header.ex} ") 

It prints into my log the following and that what I exactly need from the beginning :
CustomException: java.lang.IOException

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文