camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raul Kripalani <r...@fusesource.com>
Subject Re: Camel CXF: In-VM
Date Fri, 10 Aug 2012 14:02:10 GMT
Hi,

Yes, Camel supports any kind of object as message bodies. Your bean can
declare any type of parameter in methods, including business DTOs, e.g.:

public class CartHandler {
    public CartDTO createCartForOrder(OrderDTO order) {
       ...
       return cartDto;
    }
}


Then instantiate CartHandler in your Spring application context definition:

<bean name="cartHandler" class="org.mycompany.CartHandler" />


You can then use "cartHandler" in your bean endpoint URI, e.g. <to
uri="bean:cartHandler" />, or you could also use the bean DSL as shown in
[1]. With either option, you can specify the method to invoke.

If you happen to receive the DTO in a serialised format in your route (e.g.
XML, JSON, etc.), you can use Data Formats to unmarshal it into an object,
or implement custom logic to process it.

Remember that Camel also has an automatic, transparent type conversion
mechanism you could leverage [2]. IIRC, it is capable of applying JAXB
transformations automatically.

[1]
http://camel.apache.org/bean-binding.html#BeanBinding-Parameterbindingusingmethodoption
[2] http://camel.apache.org/type-converter.html

Regards,

*Raúl Kripalani*
*Principal Consultant | FuseSource Corp.
raul@fusesource.com | fusesource.com <http://www.fusesource.com/>
skype: raul.fuse | twitter: @raulvk <http://twitter.com/raulvk>,
@fusenews<http://twitter.com/fusenews>
*
blog: F3 - Flashes From the
Field<http://blog.raulkr.net/?utm_source=fusesourceemail&utm_medium=email&utm_campaign=fusesourcemail>
 | aboutme: http://about.me/raulkripalani

<http://twitter.com/fusenews>

On 9 August 2012 22:48, objectorange <brian@briantaylor.us> wrote:

> I looked into Camel:Bean but all of the examples show RPC-like method calls
> with String as the parameters. Does it support Object parameters? How would
> JAXB be used or would we have to parse incoming XML ourselves in the
> service
> implementation?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-CXF-In-VM-tp5716772p5717098.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message