camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
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
<Trivedi.Bodlapati@ge.com> 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.
>

Hi

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

You can use bean parameter binding
http://camel.apache.org/parameter-binding-annotations.html

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: http://old.nabble.com/Accessing-exchange-from-producer-template-tp26704478p26704478.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Mime
View raw message