camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Calvert, Zach (Zach)** CTR **" <>
Subject RE: Synchronous Message
Date Wed, 26 Oct 2011 22:05:04 GMT
Just in case anyone cares, the problem was not the route, or the way I was sending, but the
configuration of the exchange.

I didn't realize the route didn't define the InOut protocol, but you must set exchange.setPattern(ExchangePattern.InOut);

Zach Calvert

-----Original Message-----
From: Calvert, Zach (Zach)** CTR ** [] 
Sent: Wednesday, October 26, 2011 2:09 PM
Subject: Synchronous Message

I'm using ServiceMix version 4.3.0 and simply trying to send a synchronous message where I
can get access to the MessageOut at the end.

I have tried using the ProducerTemplate as well as the  camelContext.getEndpoint("myendpoint").createProducer().process(exchange);
And nothing seems to fully fit my needs.

Making the assumption I have a properly constructed exchange, endpoint, camelContext, producerTemplate,
I have the following examples and why they don't work the way I need them to:

Example 1:
    producer.send(exchange);  // doesn't work because it doesn't block.  The MessageOut doesn't
contain the true message out body
Example 2:
    endpoint.createProducer().process(exchange);  // doesn't block
Example 3:
    producer.sendBodyAndHeaders(endpoint, "body", headersMap); // blocks, but I can't get
a handle to the MessageOut from the exchange, just the body - and yes I have confirmed the
body is correct so the endpoints really are behaving the way I expect
Example 4:
    Future<Exchange> result = producer.asyncSend(endpoint, exchange);
    Exchange idealResult = result.get();  // doesn't actually block and my code is instant,
Exchange isn't populated with MessageOut

When I say these things aren't blocking, I'm reviewing the logs and making sure that it really
is not blocking.  Ideally, I have a producer.send message which actually blocks and then I
can get the various messages after the processing is complete.  What am I missing?

Zach Calvert

View raw message