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: JAXB Data Format
Date Thu, 16 Aug 2012 13:32:08 GMT
On Thu, Aug 16, 2012 at 3:16 PM, Joe San <codeintheopen@gmail.com> wrote:
> Thanks for pointing me to toe documentation. My actual question got
> clarified once I had a look into the documentation.
>
> From the Camel in Action book:
>
> from("quartz://report?cron=0+0+6+*+*+?")
> .to("http://riders.com/orders/cmd=received&date=yesterday")
> .bean(new OrderToCsvBean())
> .to("file://riders/orders?fileName=report-${header.Date}.csv");
>
> How does Camel know which method in the OrderToCsvBean() class to invoke.
> Unfortunately the book does not mentions this in Chapter 3. Not sure if it
> is mentioned in Chapter 4 as I'm yet to start with Chapter 4.
>

Yep chapter 4 is all about using beans/pojos with Camel; see for
example page 105.

But basically if the pojo/bean has 1 method, then Camel knows that it
should invoke that method.
Its when you have 2+ methods it gets more complicated. You can of
course tell Camel the method name to use etc.

But its all covered as well in chapter 4, as well you can find pieces
of details scattered online in the Camel docs.


> Regards,
> Jothi
>
> On Thu, Aug 16, 2012 at 2:46 PM, Babak Vahdat
> <babak.vahdat@swissonline.ch>wrote:
>
>> Check the documentation for this:
>>
>> http://camel.apache.org/bean-binding.html
>>
>> Babak
>>
>> Am 16.08.12 14:32 schrieb "Joe San" unter <codeintheopen@gmail.com>:
>>
>> >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?
>> >
>> >Regards,
>> >Jothi
>> >
>> >On Thu, Aug 16, 2012 at 1:56 PM, Joe San <codeintheopen@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: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message