m j
m j

Reputation: 1

Issue with Camel Jetty Asynchronous Routing

I am trying to use Jetty continuations with AsyncProcessor in Apache Camel and have to run into issues. Basically I want the Jetty web request to wait until a multicast/aggregate route finishes and then populate the servletResponse with the result. So my camel route file is as follows,

    <route>
        <from ref="incomingJettyEndpoint"/>
        <inOnly uri="direct:multiCastRoute"/>
                    <process ref="asyncProcessor"/> 
    </route>
            <route>
                    <!-- Aggregator -->
            </route>

I am passing the continuations object in the header of the exchanges which I am trying to use to send the response back. Can anyone help me with the asyncProcessor so that the thread waits there and does not complete the continuation? Additionally, can I inform the asyncProcessor from the aggregator after all the multicast messages are returned so that I can write back the result?

Upvotes: 0

Views: 681

Answers (1)

AlanFoster
AlanFoster

Reputation: 8306

the inOnlyon your route means that it doesn't process the response.

Just use to instead, like

<route>
    <from ref="incomingJettyEndpoint"/>
    <to uri="direct:multiCastRoute"/>
    <process ref="asyncProcessor"/> 
</route>
<route>
    <!-- Aggregator -->
</route>

Upvotes: 1

Related Questions