On Thu, Aug 16, 2012 at 2:32 PM, Joe San <codeintheo...@gmail.com> wrote: > I have decided to use JAXB instead of xStream. My route definition looks > like this: > > final JaxbDataFormat jaxb = new > JaxbDataFormat("com.example.filexml"); > context.addRoutes(new RouteBuilder() { > public void configure() { > from("file://my.xml").unmarshal(jaxb).bean(new > ProcessorBean()).to("file://my.xml"); > } > }); > > How do I get hold of the UnMarshalled Java Object (say Person.java) in my > ProcessorBean. Also, when I use a bean for Processing, how does Camel know > which method to invoke in that bean? >
If you use the Camel Processor, then you get it from the Exchange, eg the input message. On the message body. http://camel.apache.org/processor.html For invoking pojos (beans) instead, then read through the Camel docs about bean component / bean parameter binding / etc. http://camel.apache.org/bean-binding.html If you have a copy of Camel in Action book, then chapter 3 and 4 is a great source for all this kind of stuff. And explained in much detail. > Regards, > Jothi > > On Thu, Aug 16, 2012 at 1:56 PM, Joe San <codeintheo...@gmail.com> wrote: > >> Guys, >> >> I have a route which is defined as below: >> >> from("file://my.xml").marshal().xstream("UTF-8").bean(new >> ProcessorBean()).to("file://my.xml"); >> >> All I want to do is access the my.xml in my ProcessorBean. Where and how >> do I specify the Java object which will be filled with the values in the >> xml file? >> >> Regards, >> Jothi >> -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen