camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Synchronous Message
Date Thu, 27 Oct 2011 06:26:20 GMT
On Thu, Oct 27, 2011 at 12:05 AM, Calvert, Zach (Zach)** CTR **
<> wrote:
> 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);

Thanks for sharing your solution. Glad you got it working.

> Zach Calvert
> -----Original Message-----
> From: Calvert, Zach (Zach)** CTR ** []
> Sent: Wednesday, October 26, 2011 2:09 PM
> To:
> 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
> 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?
> Thanks,
> Zach Calvert

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message