- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我得到了带有 Camel (3.5.0)应用程序的 Spring Boot (2.3.2.RELEASE)和两条测试路线:
这个想法是检查从多播调用的子路由中发生异常时会发生什么以及它如何处理事务。
@Component
public class MyRoute1 extends RouteBuilder {
@Override
public void configure() {
onException(Exception.class)
.useOriginalBody()
.log("Error handler parent. Body is: ${body}")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
System.out.println(cause.getMessage());
cause.printStackTrace(System.out);
}
})
.handled(true);
from("jms:queue:EventsQueue")
.routeId("route1")
.onCompletion().log("On complete parent").end()
.transacted()
.multicast(AggregationStrategies.useOriginal(), false)
.to("direct:route2")
.log("Second step")
.end()
.log("Third step");
}
}
和
@Component
public class MyRoute2 extends RouteBuilder {
@Override
public void configure() {
onException(IOException.class)
.log("Error handling child");
from("direct:route2")
.routeId("route2")
.onCompletion().log("On complete child").end()
.log("First step")
.throwException(new IOException("Very bad exception"));
}
}
当我向
jms:queue:EventsQueue
发送消息时我希望交换将失败并抛出我的异常并遵循自定义日志消息的顺序:
First step
Error handling child
On complete child
On complete parent
不应触发其他日志消息。
java.lang.NullPointerException
被多播聚合策略抛出并被父级捕获
onException
堵塞。所以自定义日志的顺序是:
First step
Error handling child
On complete child
Error handler parent
null
java.lang.NullPointerException
at org.apache.camel.processor.aggregate.UseOriginalAggregationStrategy.aggregate(UseOriginalAggregationStrategy.java:62)
...
On complete parent
有趣的部分来了:如果我删除
.transacted()
父路由行为改变中的方法。
java.lang.NullPointerException
异常仍然被聚合策略抛出,但它没有被我的 parent 捕获
onException
堵塞。
.transacted()
:
2020-11-03 14:38:35.800 INFO 11744 --- [ main] a.test.errors.MySpringBootApplication : Started MySpringBootApplication in 3.44 seconds (JVM running for 3.916)
2020-11-03 14:38:46.389 INFO 11744 --- [[EventsPsQueue]] route2 : First step
2020-11-03 14:38:46.394 INFO 11744 --- [[EventsPsQueue]] route2 : Error handling child
2020-11-03 14:38:46.398 ERROR 11744 --- [[EventsPsQueue]] o.a.c.p.e.DefaultErrorHandler : Failed delivery for (MessageId: queue_EventsPsQueue_ID_wsc-111-71a-44245-1603872340334-4_9_1_1_3 on ExchangeId: ID-wsc-111-71a-1604403526383-0-2). Exhausted after delivery attempt: 1 caught: java.io.IOException: Very bad exception. Processed by failure processor: FatalFallbackErrorHandler[Channel[log5]]
Message History (complete message history is disabled)
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [from[jms://queue:EventsPsQueue] ] [ 25]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.io.IOException: Very bad exception
at activemq.test.errors.chapter1.MyRoute2.configure(MyRoute2.java:20) ~[classes/:na]
at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:483) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:430) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:405) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1185) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:93) ~[camel-main-3.5.0.jar:3.5.0]
at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:101) ~[camel-spring-boot-3.5.0.jar:3.5.0]
at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:57) ~[camel-spring-boot-3.5.0.jar:3.5.0]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at activemq.test.errors.MySpringBootApplication.main(MySpringBootApplication.java:13) ~[classes/:na]
2020-11-03 14:38:46.400 WARN 11744 --- [[EventsPsQueue]] o.a.c.s.spi.TransactionErrorHandler : Transaction rollback (0x347b370c) redelivered(false) for (MessageId: queue_EventsPsQueue_ID_wsc-111-71a-44245-1603872340334-4_9_1_1_3 on ExchangeId: ID-wsc-111-71a-1604403526383-0-2) caught: java.io.IOException: Very bad exception
2020-11-03 14:38:46.401 INFO 11744 --- [[EventsPsQueue]] route2 : On completion child
2020-11-03 14:38:46.401 INFO 11744 --- [[EventsPsQueue]] route1 : Error handler parent. Body is: TEST MESSAGE
null
java.lang.NullPointerException
at org.apache.camel.processor.aggregate.UseOriginalAggregationStrategy.aggregate(UseOriginalAggregationStrategy.java:62)
at org.apache.camel.AggregationStrategy.aggregate(AggregationStrategy.java:86)
at org.apache.camel.processor.MulticastProcessor.doAggregateInternal(MulticastProcessor.java:628)
at org.apache.camel.processor.MulticastProcessor.doAggregateSync(MulticastProcessor.java:609)
at org.apache.camel.processor.MulticastProcessor.doAggregate(MulticastProcessor.java:594)
at org.apache.camel.processor.MulticastProcessor$MulticastTask.aggregate(MulticastProcessor.java:413)
at org.apache.camel.processor.MulticastProcessor$MulticastTask.lambda$null$0(MulticastProcessor.java:393)
at org.apache.camel.AsyncCallback.run(AsyncCallback.java:44)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.schedule(DefaultReactiveExecutor.java:55)
at org.apache.camel.processor.CamelInternalProcessor$AsyncAfterTask.done(CamelInternalProcessor.java:186)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:129)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:287)
at org.apache.camel.processor.MulticastProcessor$MulticastTask.lambda$run$1(MulticastProcessor.java:367)
at org.apache.camel.util.concurrent.AsyncCompletionService$Task.run(AsyncCompletionService.java:150)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:65)
at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:273)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:723)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:632)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:65)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:181)
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:164)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:261)
at org.apache.camel.processor.Pipeline$PipelineTask.run(Pipeline.java:90)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:65)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:145)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:723)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:632)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:65)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:181)
at org.apache.camel.spring.spi.TransactionErrorHandler.access$201(TransactionErrorHandler.java:45)
at org.apache.camel.spring.spi.TransactionErrorHandler$2.process(TransactionErrorHandler.java:238)
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:235)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:110)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:123)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:723)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:632)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleSync(DefaultReactiveExecutor.java:65)
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:181)
at org.apache.camel.spring.spi.TransactionErrorHandler.access$201(TransactionErrorHandler.java:45)
at org.apache.camel.spring.spi.TransactionErrorHandler$2.process(TransactionErrorHandler.java:238)
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
at org.apache.camel.spring.spi.TransactionErrorHandler.processByErrorHandler(TransactionErrorHandler.java:235)
at org.apache.camel.spring.spi.TransactionErrorHandler$1.doInTransactionWithoutResult(TransactionErrorHandler.java:198)
at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:36)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:191)
at org.apache.camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:146)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:114)
at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:123)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:287)
at org.apache.camel.processor.Pipeline$PipelineTask.run(Pipeline.java:90)
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148)
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:147)
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:287)
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83)
at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:41)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:130)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:245)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2020-11-03 14:38:46.407 INFO 11744 --- [[EventsPsQueue]] route1 : On complete parent
2020-11-03 14:38:46.411 WARN 11744 --- [[EventsPsQueue]] c.c.j.DefaultJmsMessageListenerContainer : Setup of JMS message listener invoker failed for destination 'EventsPsQueue' - trying to recover. Cause: Transaction rolled back because it has been marked as rollback-only
没有事务支持的 Camel 日志:
2020-11-03 14:40:27.748 INFO 11981 --- [ main] a.test.errors.MySpringBootApplication : Started MySpringBootApplication in 3.234 seconds (JVM running for 3.643)
2020-11-03 14:40:36.828 INFO 11981 --- [[EventsPsQueue]] route2 : First step
2020-11-03 14:40:36.832 INFO 11981 --- [[EventsPsQueue]] route2 : Error handling child
2020-11-03 14:40:36.837 ERROR 11981 --- [[EventsPsQueue]] o.a.c.p.e.DefaultErrorHandler : Failed delivery for (MessageId: queue_EventsPsQueue_ID_wsc-111-71a-44245-1603872340334-4_9_1_1_4 on ExchangeId: ID-wsc-111-71a-1604403636824-0-2). Exhausted after delivery attempt: 1 caught: java.io.IOException: Very bad exception. Processed by failure processor: FatalFallbackErrorHandler[Channel[log5]]
Message History (complete message history is disabled)
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [from[jms://queue:EventsPsQueue] ] [ 24]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.io.IOException: Very bad exception
at activemq.test.errors.chapter1.MyRoute2.configure(MyRoute2.java:20) ~[classes/:na]
at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:483) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:430) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:405) ~[camel-core-engine-3.5.0.jar:3.5.0]
at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1185) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:93) ~[camel-main-3.5.0.jar:3.5.0]
at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:101) ~[camel-spring-boot-3.5.0.jar:3.5.0]
at org.apache.camel.spring.boot.CamelSpringBootApplicationListener.onApplicationEvent(CamelSpringBootApplicationListener.java:57) ~[camel-spring-boot-3.5.0.jar:3.5.0]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:898) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.2.RELEASE.jar:2.3.2.RELEASE]
at activemq.test.errors.MySpringBootApplication.main(MySpringBootApplication.java:13) ~[classes/:na]
2020-11-03 14:40:36.838 INFO 11981 --- [[EventsPsQueue]] route2 : On completion child
2020-11-03 14:40:36.839 INFO 11981 --- [[EventsPsQueue]] route1 : On complete parent
2020-11-03 14:40:36.848 WARN 11981 --- [[EventsPsQueue]] o.a.c.c.jms.EndpointMessageListener : Execution of JMS message listener failed. Caused by: [org.apache.camel.RuntimeCamelException - java.lang.NullPointerException]
org.apache.camel.RuntimeCamelException: java.lang.NullPointerException
at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:51) ~[camel-api-3.5.0.jar:3.5.0]
at org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:213) ~[camel-jms-3.5.0.jar:3.5.0]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:134) ~[camel-jms-3.5.0.jar:3.5.0]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:245) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076) ~[spring-jms-5.2.8.RELEASE.jar:5.2.8.RELEASE]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.lang.NullPointerException: null
at org.apache.camel.processor.aggregate.UseOriginalAggregationStrategy.aggregate(UseOriginalAggregationStrategy.java:62) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.AggregationStrategy.aggregate(AggregationStrategy.java:86) ~[camel-api-3.5.0.jar:3.5.0]
at org.apache.camel.processor.MulticastProcessor.doAggregateInternal(MulticastProcessor.java:628) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.MulticastProcessor.doAggregateSync(MulticastProcessor.java:609) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.MulticastProcessor.doAggregate(MulticastProcessor.java:594) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.MulticastProcessor$MulticastTask.aggregate(MulticastProcessor.java:413) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.MulticastProcessor$MulticastTask.lambda$null$0(MulticastProcessor.java:393) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.AsyncCallback.run(AsyncCallback.java:44) ~[camel-api-3.5.0.jar:3.5.0]
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:148) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:60) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:147) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:287) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:83) ~[camel-base-3.5.0.jar:3.5.0]
at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:41) ~[camel-support-3.5.0.jar:3.5.0]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:130) ~[camel-jms-3.5.0.jar:3.5.0]
... 11 common frames omitted
问题是:
java.lang.NullPointerException
如果在子路由中发生其他异常,则在多播期间。 最佳答案
对于 onException,还有另外两件事可以设置为 真或 假 分别是 handled
和 continued
.我认为这些向您解释了异常如何传播到父路由。
If handled is true, then the thrown exception will be handled and Camel will not continue routing in the original route, but break out
In Camel 2.3 we introduced a new option continued which allows you to both handle and continue routing in the original route as if the exception did not occur.
transacted()
我不知道。我正在阅读它,如果我找到答案,会将您链接到该答案。
关于error-handling - Apache camel 错误处理如何处理多播和事务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64662473/
我创建了一个 spring-boot 应用程序,我在其中使用 camel-reSTLet 组件将我的 camel 路由公开为 rest 端点。 我的 camel 路由很简单:它们接受来自北向休息端点的
我有一条路由 (route1),它将数据发送到 HTTP 端点。为此,它必须设置授权 header 。 header 值每小时超时一次,必须更新。 为此,我创建了另一个路由 (route2),它使用提
我正在使用 camel-cdi,它正在注入(inject) CamelContext,检测项目中的所有路由。但是我想要一个带有注册表的 CamelContext,因为我有一些在 Camel route
我想使用来自网络服务的数据并将其放入 Camel eh-cache 中。后来我想通过 CacheManager 在 Camel 上下文之外使用这个缓存。我没有找到任何方法。 在下面的代码中,我跳过了
问题描述: 我无法从我的 Camel servlet 路由到 cxfbean。路由初始化失败并显示以下错误消息: "Failed to create route route1 at: >>> To[c
我想了解 Camel 中的工作单元概念。我有一个简单的问题,希望这里有人可以提供帮助。 例如,如果路由 Exchange 涉及多个路由 from("aws-sqs:Q1").to("direct:pr
首先是我正在尝试做的事情的基本轮廓 我有一个 MQ,我想从 读取消息 预处理 XML,并在 Exchange 上设置属性 发出 HTTP 请求 处理来自 http 请求和初始交换中的属性的数据 将其放
我有一个 SFTP 路由(在 Spring XML 中),它的 from 路径以每日更改的目录(即/yyyyMMdd)结尾,并且在 autoCreate=true 时一切正常或者路径开始时目录存在。但
如何用 Camel 实现这样的过程: 拆分 处理每个拆分的项目 聚合结果 如果发生异常: 停止 split 返回异常前所有item的聚合结果及异常信息 split时定义.stopOnException
我在 Camel 中有一条路线,我想在发生异常时重试,但我想设置一个属性,以便路线第二次可以做一些稍微不同的事情,以尝试阻止错误在重试时再次发生。这是说明我目前正在尝试的想法的路线。 from("di
这两个有何不同 from(endpoint).to(endpoint:a, endpoint:b) from(endpoint).multicast().to(endpoint:a, endpoint
我的 Camel 路线如下(示例) from (activemq:xyz) --- 从 QUEUE 接收消息 to(smpp:abc) --- 提交短信至短信中心 to(cxf:hij) --- 基于
我的 Camel 路线如下(示例) from (activemq:xyz) --- 从队列接收消息 to(smpp:abc) --- 将消息提交给 SMSC to(cxf:hij) --- 基于 SM
当捕获异常时,有什么方法可以停止路由执行(显示日志消息后)? java.lang.IllegalA
我正在使用 Camel 进行集成。我有一个用例,其中 Camel 应该将 1 条消息从一个队列传输到另一个队列,但它不断向队列发送相同的消息。请查看我的以下路线: ProducerTemplate正在
当异常在多播内部抛出时,Camel 不会传播异常。 考虑到以下设置,其中 direct:route 从其 beanRef 抛出异常: rest("/...") .pos
有没有办法使用生产者模板设置 Camel 交换属性? 想象一个接收客户订单的休息端点(尚未在 Camel route )。使用生产者模板,我想 在交易所上设置客户 ID 属性。 稍后在路由 需要时使用
再见,我的基本要求是有一个可以发送消息的路由,并将其放在 JMS 队列中。 camel 上下文在 JavaEE 6 容器中运行,即 JBoss AS 7.1.1,因此它是 HornetQ for JM
Camel 2.23.1 Karaf 4.2.4 白羊座蓝图(用于注册所有内容的外部容器) Camel 蓝图(用于 Camel 路线) Camel CXF(用于 rsServer) CXF 核心(用于
现在我在 Java EE 7 应用程序上使用 JMS 2.0 和 Artemis 1.2.0,我想用 Camel 做一些集成任务。 现在查看 camel-jms 文档,没有提及如何使用通用的 came
我是一名优秀的程序员,十分优秀!