apache-camelfuseesbapache-servicemix

org.apache.camel.ExchangeTimedOutException: The OUT message was not received within: 30000 millis


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>

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. 

The stacktrace cause :

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

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

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

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


Solution

  • When you send the message to the seda endpoint using

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

    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

    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" />