org.apache.camel.ExchangeTimedOutException:在 30000 毫秒内未收到 OUT 消息 [英] org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 30000 millis

查看:29
本文介绍了org.apache.camel.ExchangeTimedOutException:在 30000 毫秒内未收到 OUT 消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 fuse esb + apache camel + seda/activemq 公开 Web 服务,但在将状态消息返回给 Web 服务调用时遇到了问题.

I'm trying to expose a web service using fuse esb + apache camel + seda/activemq and I'm facing to an issue returing a status message to the web service call.

这是我的简单骆驼路线:

here is my simple camel route :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
    http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">

    <cxf:cxfEndpoint id="msgInEndpoint" address="http://localhost:9000/msgin/"
        serviceClass="com.test.jaxws.MsgInEndpoint">
    </cxf:cxfEndpoint>

    <camelContext xmlns="http://camel.apache.org/schema/spring">
        <route id="control">
            <from uri="cxf:bean:msgInEndpoint" />
            <to uri="log:incomingMsgIn" />
            <to uri="seda:OpCon.MSGIN" />
            <transform>
                <constant>OK</constant>
            </transform>
        </route>
    </camelContext>
</beans>

当我使用soapUI 进行网络服务请求时,遇到超时问题:

When I do a web service request using soapUI, in going to a timeout issue :

Exhausted after delivery attempt: 1 caught: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 30000 millis. 

堆栈跟踪原因:

Caused by: org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 30000 millis. Exchange[Message: $CONSOLE:DISPLAY,test]
    at org.apache.camel.component.seda.SedaProducer.process(SedaProducer.java:112)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:114)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:284)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:109)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:99)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:59)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.Pipeline.process(Pipeline.java:79)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:139)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:106)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[89:org.apache.camel.camel-core:2.8.0.fuse-02-05]
    at org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:88)[143:org.apache.camel.camel-cxf:2.8.0.fuse-02-05]
    at org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:68)[143:org.apache.camel.camel-cxf:2.8.0.fuse-02-05]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_26]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_26]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_26]
    at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:319)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:287)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[133:org.apache.cxf.bundle:2.4.3.fuse-01-02]
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.Server.handle(Server.java:346)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:438)[115:org.eclipse.jetty.server:7.4.5.fuse20111017]
    ... 8 more

我使用 seda 或 activemq 作为消费者有相同的结果,但它适用于文件消费者.

I have the same result using seda or activemq as consumer, but it works fine with file consumer.

我使用的是 apache-servicemix-4.4.1-fuse-02-05 版本.

I'm on apache-servicemix-4.4.1-fuse-02-05 version.

知道我做错了什么吗?感谢您的帮助

Any idea of what I'm doing wrong? Thanks for your help

推荐答案

当你使用发送消息到 seda 端点时

When you send the message to the seda endpoint using

<to uri="seda:OpCon.MSGIN" />

并且消息源自 Web 服务,然后消息使用 InOut 作为消息交换模式(例如请求/回复),这意味着 Camel 期待回复".从 seda 队列中,从某种意义上说,它将等待消息被处理.但是由于未处理消息,因此触发了 30 秒的超时,以及您看到该异常的原因.查看超时选项:http://camel.apache.org/seda

And the message originates from a web service, then the message is using InOut as the Message Exchange Patterh (e.g. request/reply), which means Camel is expecting a "reply" from the seda queue, in the sense it will wait for the message to be processed. But as the message is not processed, then a timeout of 30 sec is triggered, and why you see that exception. See the timeout options at: http://camel.apache.org/seda

相反,您似乎想尽快将 OK 消息发送回 Web 服务,同时将消息发送到队列以进行异步进一步处理.有一个 EIP 和它的 WireTap EIP.所以改用它:https://camel.apache.org/components/3.4.x/eips/wireTap-eip.html

Instead it looks like you want to send back asap an OK message to the web service, while sending a message to a queue for asynchronous further processing. There is an EIP for that, and its the WireTap EIP. So use that instead: https://camel.apache.org/components/3.4.x/eips/wireTap-eip.html

<wireTap uri="seda:OpCon.MSGIN" />

这篇关于org.apache.camel.ExchangeTimedOutException:在 30000 毫秒内未收到 OUT 消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆