As for configuring your own JAXB formatter, take a look at this page which
shows how to use a bean defined in spring context

http://camel.apache.org/jaxb.html




On Tue, May 21, 2013 at 5:38 AM, Vegi, Vamsi (MAN-Corporate-CON) <
vamsi.v...@manheim.com> wrote:

> Thank you,
> Well CompanyMsg is indeed a JaxB annotated. it is generated by the XJC
> compiler.
> But here is the question:
> Does Camel creates the JaxBContext every time? You know, that is an
> expensive operation.
> I am talking about performance tuning here.
> If that was already taken care of, great.
>
> in case, it is not taken care of, how can I use spring bean (JaxBContext)
> and give it to Camel for it to use the type conversion.
>
> Thanks much
>
> -Vamsi
>
>
>
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ib...@gmail.com]
> Sent: Tuesday, May 21, 2013 1:13 AM
> To: users@camel.apache.org
> Subject: Re: how is the automatica type conversion happening
>
> Hi
>
> Its the type converter that kicks in
> http://camel.apache.org/type-converter.html
>
> There is a fallback converter for JAXB so when you declare the method
> signature to have CompanyMsg as parameter type, then Camel will try to
> convert the message body to this type. And as CompanyMsg is a JAXB
> annotated class, then JAXB kicks-in.
>
> On Mon, May 20, 2013 at 7:22 PM, Vegi, Vamsi (MAN-Corporate-CON) <
> vamsi.v...@manheim.com> wrote:
> > Hello
> >
> > I am confused how the camel framework is automatically unmarshalling
> > the XML file into an JaxB object Here is my Configurator, with the
> > route def
> >
> > ======================================================================
> > @Override
> > public void configure() throws Exception {
> >   LOG.info("CompanyMsgRouter: configure called");
> >   try {
> >        jaxbContext = JAXBContext.newInstance(CompanyMsg.class);
> >        jaxbUnmarshaller = jaxbContext.createUnmarshaller();
> >   } catch (JAXBException e) {
> > e.printStackTrace();
> >   }
> >
> > from("file:C:\\camel\\files\\in?noop=true") // contains XML Msg
> > .routeId(READ_Q_ROUTE_ID)
> > .log(LoggingLevel.INFO, "uploading file:${header.CamelFilePath}")
> > .bean(new TransformSvcCompanyMsg(), "getCompleteCompanyDao"); //
> > expects JAXB object here
> >
> >
> > }
> > ======================================================================
> >
> > The method: getCompleteCompanyDao has the signature like like public
> > Company getCompleteCompanyDao(final CompanyMsg compMsg) {
> > :
> > :
> > }
> >
> > Question is: when I run the app, it works fine, but I am confused as
> when and where the unmarshalling is happening.
> > I am not explicitly calling the JaxB unmarshaller Is it using the
> > jaxBUnMarshaller that I had previously defined?
> > Btw, all the needed JaxB classes are in the path.
> >
> >
> > -thanks
> > -V
> >
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> www.camelone.org: The open source integration conference.
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cib...@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
>
>
>


-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Reply via email to