Hi

Yes this is possible. The solution is to use a queue where you "split" the 
request. You can use a JMS queue or a the SEDA queues that Camel has 
out-of-the-box.
http://activemq.apache.org/camel/seda.html

The transform DSL is used for setting the OUT body = the response to the 
original caller.


Here is an example of such a scenariou. I have build a unit test to demonstrate 
this:

    public void testSendAsync() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("Hello World");

        Object out = template.requestBody("direct:start", "Hello World");
        assertEquals("OK", out);

        assertMockEndpointsSatisfied();
    }

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:start")
                    // send it to the seda queue that is async
                    .to("seda:next")
                    // return a constant response
                    .transform(constant("OK"));

                from("seda:next").to("mock:result");
            }
        };
    }




Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: raulvk [mailto:[EMAIL PROTECTED] 
Sent: 10. september 2008 19:56
To: camel-user@activemq.apache.org
Subject: Synchronous/asynchronous bridge


Hi,

I am using Camel embedded in ServiceMix via the servicemix-camel service
engine.

I need to implement the following routing scenario:


HTTP Consumer BC   ---> Camel  --->  Transformation --> HTTP Provider BC
             /|\                      |
              |______________ |


Basically, I receive a SOAP request through an HTTP endpoint in ServiceMix
and it gets directed to Camel. As soon as Camel receives it, it should
immediately return back a fixed response (<Response>OK</Response>), and then
it should invoke an XSLT Transformer, and should finally send the
transformed message to the HTTP Provider.

I am OK with the bit where I have to use a pipeline, but I don't understand
how to return the response half-way through the routing flow.

Could someone help me with this, please?

Thanks a lot!

-- 
View this message in context: 
http://www.nabble.com/Synchronous-asynchronous-bridge-tp19415072s22882p19415072.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to