camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Accessing exchange from producer template
Date Wed, 09 Dec 2009 05:57:04 GMT
On Wed, Dec 9, 2009 at 4:07 AM, trivedi kumar b
<> wrote:
> Hi,
> I have a bean that is being invoked from a route and this bean has got
> producer template.. and I want the access to exchange object to retrieve
> properties that is being set before in the route. So I have written a small
> piece of code (method) that returns me the exchange object.. pls let me know
> if there is a better to get the exchange object.


You want to get those properties in the bean, and before you use the
producer template?

You can use bean parameter binding

public void myMethod(String body, @Properties Map properties);

Or just add Exchange as a parameter to your bean.

public void myMethod(String body, Exchange exchange);

PS: Chapter 4 in Camel in Action covers using beans in great details

> private Exchange getExchange() {
>        Exchange exchange = template.send(new Processor() {
>            public void process(Exchange arg0) throws Exception { }
>        });
>        return exchange;
>    }
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Apache Camel Committer

Author of Camel in Action:
Open Source Integration:

View raw message