There is a cache of the JAXB context, so the FallbackTypeConverter don't need to create a new one per request.
-- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 21, 2013 at 8:38 PM, Vegi, Vamsi (MAN-Corporate-CON) 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 (mailto: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 (mailto: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 (http://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 (http://www.camelone.org): The open source integration > conference. > > Red Hat, Inc. > FuseSource is now part of Red Hat > Email: cib...@redhat.com (mailto:cib...@redhat.com) > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen