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

Reply via email to