gpt4 book ai didi

java - Camel 路由发布者未发布到 JMS 出站队列失败,并出现 java.util.concurrent.RejectedExecutionException

转载 作者:行者123 更新时间:2023-12-02 01:36:21 28 4
gpt4 key购买 nike

因此,我有一条路由消耗来自一个队列的 JMS 消息,并且我想将其发送到同一代理上的另一个队列。蓝图 xml 非常简单:

<camel:route id="from-jms-consumer-to-jms" trace="false">             
<from uri="jms:queue:test" />
<log message="Message consumed :: ${body}" />
<to uri="jms:queue:other_test" />
</camel:route>

但是这不起作用!它使用并记录消息(因此连接工厂没有问题),但当它尝试发布时失败,并显示 java.util.concurrent.RejectedExecutionException

为什么?我尝试了一切:

  • 独立的连接工厂
  • 池化/非池化
  • 已交易/未交易

但即使是像这样的简单路线,发布商也会失败。

这是 Camel 3.0.0-M4,我在 JDK 9 上的 Karaf 4.2.1 上运行。没有其他问题。所有其他组件都可以工作并且已经过单独测试。

我什至查看了 Camel 源代码中的 JmsPublisher 代码。有一个 isRunAllowed() booleanjmsPublisher 返回 false。我不知道我可能会错过什么?线程池?消息上的 JMSHeader?我被难住了!

错误堆栈跟踪:

Message History
---------------------------------------------------------------------------------------------------------------------------------------

RouteId ProcessorId Processor Elapsed (ms)
[from-jms-consumer-] [from-jms-consumer-] [jmsFrom://queue:test ] [ 2]
[from-jms-consumer-] [log7 ] [log ] [ 1]
[from-jms-consumer-] [to7 ] [jms:queue:other_test ] [ 0]


Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------

java.util.concurrent.RejectedExecutionException: null
at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:140) ~[127:org.apache.camel.camel-jms:3.0.0.M4]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:130) ~[110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryState.run(RedeliveryErrorHandler.java:480) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:185) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:87) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:222) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:77) [110:org.apache.camel.camel-base:3.0.0.M4]
at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:40) [143:org.apache.camel.camel-support:3.0.0.M4]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:111) [127:org.apache.camel.camel-jms:3.0.0.M4]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:736) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:696) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:674) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:318) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:245) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1189) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1179) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1076) [167:org.apache.servicemix.bundles.spring-jms:5.0.8.RELEASE_1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) [?:?]
at java.lang.Thread.run(Thread.java:844) [?:?]

最佳答案

我让发布商在路线 ( https://camel.apache.org/message-endpoint.html ) 上使用“toD”而不是“to”

现在事务管理器仍然抛出错误,无法记录事务,这意味着连接不是“NamedXAResource”wtf,但至少发布者正在发布

关于java - Camel 路由发布者未发布到 JMS 出站队列失败,并出现 java.util.concurrent.RejectedExecutionException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57515386/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com