camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject RE: Annotation @Exchange planned in a future release ?
Date Thu, 10 Jul 2008 10:31:09 GMT
Hi Charles

I have not tested my self. Going to lunch now.

However I do think you can do as #1 but without implementing the interface. Just add the Exchange
Exchange as the parameter anyway.

If not then I do think Camel should be able to do it anyway. 

The annotations are used to distinguish your parameters and to let Camel know where it should
inject the payload etc using the @Body annotation. A parameter of type org.apache.came.Exchange
does not need to be decorated with an Annotation as Camel should be able to pick up on this
and just pass the exchange directly as it's a 100% type match.

But you are welcome to drill down a small sample on this I can use as baseline for a unit
test. And if something is missing we can improve camel in this regard.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: cmoulliard [mailto:cmoulliard@gmail.com] 
Sent: 10. juli 2008 12:27
To: camel-user@activemq.apache.org
Subject: RE: Annotation @Exchange planned in a future release ?


Claus,

The way that we implement the class is not the same when you compare both
approaches

1) Without annotation

The bean implements the interface Processor and retrieves the Exchange
object through the method : process(Exchange ex)

2) Using annotation

the bean does not implement the processor so it is not possible to retrieve
the Exchange except if we inject it through additional annotation 

Regards

Charles



Claus Ibsen wrote:
> 
> Hi
> 
> I think you can do like this
> 
> public Exchange doSomething(Exchange exchange) {
>    ...
>    return exchange;
> }
> 
> So the @Exchange annotation is not really neeed IMHO. As its not a common
> class such as java.lang.String etc.
> 
> And I also think you can do return a String etc. instead of Exchange for
> just the playload in the message. But I am not 100% sure.
> 
> 
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> 
> -----Original Message-----
> From: cmoulliard [mailto:cmoulliard@gmail.com] 
> Sent: 10. juli 2008 11:34
> To: camel-user@activemq.apache.org
> Subject: Annotation @Exchange planned in a future release ?
> 
> 
> Hi,
> 
> Is it planned in a future release of Camel to also have the annotation
> @Exchange available inside the bean component ?
> 
> I ask you that question because when you want inside a bean to perform by
> example a in.getOut().setHeader("", ""), you need to have access to the
> Exchange object. The annotation allow to receive the @Properties, @Headers
> and @Body but no the exchange.
> 
> Regards,
> 
> Charles
> -- 
> View this message in context:
> http://www.nabble.com/Annotation-%40Exchange-planned-in-a-future-release---tp18379161s22882p18379161.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Annotation-%40Exchange-planned-in-a-future-release---tp18379161s22882p18379983.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message