2012-03-08 271 views
3

我想暴露一个使用fuse esb + apache camel + seda/activemq的web服务,而且我正面临着一个问题,状态消息发送到Web服务调用。org.apache.camel.ExchangeTimedOutException:OUT消息没有收到:30000毫秒

这里是我的简单的骆驼航线:

<?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 Web服务请求,在将要超时问题:

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作为消费者,但它与文件使用者正常工作。

我在apache-servicemix-4.4.1-fuse-02-05版本上。

任何想法我做错了什么? 感谢您的帮助

回答

6

当您发送使用

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

消息到SEDA端点和消息来源于形成一个Web服务,然后将消息了使用InOut的消息交换Patterh(如请求/回复),这意味着骆驼正在等待来自赛达队列的“回复”,从某种意义上说,它将等待消息被处理。但是,由于消息未处理,因此会触发30秒的超时,并看到该异常。请参阅以下网址的超时选项:http://camel.apache.org/seda

取而代之,它看起来像您希望尽快发送OK消息到Web服务,同时将消息发送到队列进行异步进一步处理。有一个EIP和它的WireTap EIP。所以使用来代替:http://camel.apache.org/wire-tap

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

感谢您的回复克劳斯,你对我忘了那个EIP!我在ESB领域非常新,而且我仍然每天都在学习它。将来会尝试更多地关注EIPs;) – oeil 2012-03-09 14:05:53

+0

我也遇到了同样的JMS异常,我是否也应该使用wireTap for JMS。目前我使用或者我应该在jms选项中使用disableReplyTo = true,哪一个更好。 – vashishth 2014-01-08 12:41:52

0

要解决的问题,您可以增加超时值或者您可以通过使用0或负值只是禁止超时。

如何禁用超时?

答: “SEDA:someName超时= 0?”

设置超时= 0之后,你将不会面临超时错误。