1
votes

camel-fuse 2.8

I have a camel jaxrs server which accepts requests then kicks-off 2 Camel routes.

The first route, consumes requests from cxfrs endpoint/bean and ships them to jms queue inbox.

The second route, consumes requests from jms queue inbox for business logic processing, then ships the results to jms queue outbox.

My question is related to http response and sending the results to jaxrs server consumer.

Is it possible to send an http response back to http client from first route with results from second route? (synchronously)

        from("cxfrs:bean:personLookupEndpoint")   <-- http client waits for response...
            .setExchangePattern(ExchangePattern.InOut)
            .process(new RequestProcessor())
            .to(inbox);


        from(inbox)
            .unmarshal(jaxb)
            .process(new QueryServiceProcessor())
            .to("bean:lookupService?method=processQuery(${body})")
            .convertBodyTo(String.class)
            .to(outbox);  <-- need to send results to font-end consumer synchronously ...
1

1 Answers

1
votes

Do you really need to do it using queues? I think that it would be better to use direct: routes instead.

There is a possibility to use the InOut exchange pattern for a JMS endpoint, but it has some limitations: http://fusesource.com/docs/router/2.2/transactions/JMS-Synchronous.html