【发布时间】:2021-07-06 04:31:06
【问题描述】:
我一直在反复讨论我们系统上的一个问题,即使在论坛上进行了一些研究并进行了多次测试,我们似乎也无法解决。
我会尽量清楚我们正在处理的事情
我们有一个主服务,其路由从 activemq 队列(带有嵌入式代理的 spring boot)中读取,将其发送到 Route(B),然后将所有内容发送到最终的 Route(C)。 Route(B) 依赖于服务。
骆驼版本:3.3.0 Spring-boot 版本:2.3.3.RELEASE
A路:
onException(Exception::class.java)
.handled(true)
.bean("foo.ErrorProcessor", "processError")
from("activemq:queue:myqueue")
.routeId("myroute")
.to("direct:my_external_route")
.to(ExchangePattern.InOnly,"direct:myroute_result")
B路:
onException(Exception::class.java)
.handled(true)
.bean("foo.ErrorProcessor", "processError")
from("direct:my_external_route")
.routeId("my_external_route")
.process {something()} //This processor can throw exceptions that are treated in our processor
路线 C:
from("direct:myroute_result")
.process(someProcess())
.to(ExchangePattern.InOnly,"activemq:queue:results_queue")
Spring Boot activemq 配置
spring:
jmx:
enabled: true
activemq:
broker-url: vm://localhost?broker.persistent=false,useShutdownHook=false
in-memory: true
non-blocking-redelivery: true
packages:
trust-all: false
trusted: com.mypackage
pool:
block-if-full: true
block-if-full-timeout: -1
enabled: false
idle-timeout: 30000
max-connections: 10
time-between-expiration-check: -1
use-anonymous-producers: true
当 B 的处理器不抛出异常时,一切都运行得非常顺利。当它发生时,即使它们正在被处理并且在消息正文中返回了一个普通对象,我们在日志中所拥有的只是
2021-04-10 15:33:32.354 DEBUG [#1 - JmsConsumer[consumerName]] o.a.c.p.Pipeline
: Message exchange has failed: so breaking out of pipeline for exchange: Exchange[ID-1234] Handled by the error handler. {}
我们甚至为我们的 activemq 连接工厂添加了一个默认错误处理程序,但那里也没有任何反应。我们有一个 DLQ 消费者,他似乎也没有得到任何东西。 routeA 上的错误处理器也没有捕获任何预期的东西,因为之前处理了异常。
有没有人遇到过这个问题或类似问题?我知道过去曾提出过 Camel 和 JMS 组件之间关于错误处理的一些问题,但我们正在努力理解这个问题的根源。
提前致谢, 佩德罗
【问题讨论】:
标签: spring-boot kotlin error-handling apache-camel activemq