You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Leonard Axelsson <le...@gmail.com> on 2011/03/22 12:57:53 UTC

Documentation for automatic marshalling and unmarshalling

Hi,

At my current gig we have a route roughly like the one below where we send
in objects using the ProducerTemplate. Those are marshalled into xml using
JAXB (annotations) and then sent on to a JMS queue.

jaxb = new JaxbDataFormat("com.entraction.elp.api.message");

from("direct:in")
    .marshal(jaxb)
    .to("jms:someQueue")


What I found by mistake was that the route worked even if I remove the
marshalling step. The object will automatically, it seems, be marshalled. My
questions is, is this the right behaviour and if it is, where is this
feature documented? Automatic marshalling is nice, but I would like to know
for sure that it's intended and not a side effect of something else we do.

Regards,
/Leo

---------------------------------------------------------
Leonard Axelsson
Agical AB

E-mail: leonard.axelsson@agical.com
Blog: http://xlson.com/
Twitter: xlson

Re: Documentation for automatic marshalling and unmarshalling

Posted by Leonard Axelsson <le...@gmail.com>.
Thanks for the explanation, both of you! I was reading the documentation but
couldn't really make out if that was what was meant to happen or not.

/Leo

On Sat, Mar 26, 2011 at 11:19 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Its the type converter that can kick in and can convert JAXB objects
> if you have camel-jaxb on the classpath
> http://camel.apache.org/type-converter.html
>
>
>
> On Tue, Mar 22, 2011 at 12:57 PM, Leonard Axelsson
> <le...@gmail.com> wrote:
> > Hi,
> >
> > At my current gig we have a route roughly like the one below where we
> send
> > in objects using the ProducerTemplate. Those are marshalled into xml
> using
> > JAXB (annotations) and then sent on to a JMS queue.
> >
> > jaxb = new JaxbDataFormat("com.entraction.elp.api.message");
> >
> > from("direct:in")
> >    .marshal(jaxb)
> >    .to("jms:someQueue")
> >
> >
> > What I found by mistake was that the route worked even if I remove the
> > marshalling step. The object will automatically, it seems, be marshalled.
> My
> > questions is, is this the right behaviour and if it is, where is this
> > feature documented? Automatic marshalling is nice, but I would like to
> know
> > for sure that it's intended and not a side effect of something else we
> do.
> >
> > Regards,
> > /Leo
> >
> > ---------------------------------------------------------
> > Leonard Axelsson
> > Agical AB
> >
> > E-mail: leonard.axelsson@agical.com
> > Blog: http://xlson.com/
> > Twitter: xlson
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Documentation for automatic marshalling and unmarshalling

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Its the type converter that can kick in and can convert JAXB objects
if you have camel-jaxb on the classpath
http://camel.apache.org/type-converter.html



On Tue, Mar 22, 2011 at 12:57 PM, Leonard Axelsson
<le...@gmail.com> wrote:
> Hi,
>
> At my current gig we have a route roughly like the one below where we send
> in objects using the ProducerTemplate. Those are marshalled into xml using
> JAXB (annotations) and then sent on to a JMS queue.
>
> jaxb = new JaxbDataFormat("com.entraction.elp.api.message");
>
> from("direct:in")
>    .marshal(jaxb)
>    .to("jms:someQueue")
>
>
> What I found by mistake was that the route worked even if I remove the
> marshalling step. The object will automatically, it seems, be marshalled. My
> questions is, is this the right behaviour and if it is, where is this
> feature documented? Automatic marshalling is nice, but I would like to know
> for sure that it's intended and not a side effect of something else we do.
>
> Regards,
> /Leo
>
> ---------------------------------------------------------
> Leonard Axelsson
> Agical AB
>
> E-mail: leonard.axelsson@agical.com
> Blog: http://xlson.com/
> Twitter: xlson
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Documentation for automatic marshalling and unmarshalling

Posted by "Willem.Jiang" <wi...@gmail.com>.
Hi,

There is a FallbackTypeConverter[1] will help you do this kind of job of the
message body's class is annotated with JAXB annotations. If you put the
camel-jaxb into your class path, this fallback type converter will be used
by default.

If you don't want to use it , you need to convert the message body yourself
before the fallback type converter get to work :)

[1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/FallbackTypeConverter.java

Willem


Leonard Axelsson wrote:
> 
> Hi,
> 
> At my current gig we have a route roughly like the one below where we send
> in objects using the ProducerTemplate. Those are marshalled into xml using
> JAXB (annotations) and then sent on to a JMS queue.
> 
> jaxb = new JaxbDataFormat(&quot;com.entraction.elp.api.message&quot;);
> 
> from(&quot;direct:in&quot;)
>     .marshal(jaxb)
>     .to(&quot;jms:someQueue&quot;)
> 
> 
> What I found by mistake was that the route worked even if I remove the
> marshalling step. The object will automatically, it seems, be marshalled.
> My
> questions is, is this the right behaviour and if it is, where is this
> feature documented? Automatic marshalling is nice, but I would like to
> know
> for sure that it's intended and not a side effect of something else we do.
> 
> Regards,
> /Leo
> 
> ---------------------------------------------------------
> Leonard Axelsson
> Agical AB
> 
> E-mail: leonard.axelsson@agical.com
> Blog: http://xlson.com/
> Twitter: xlson
> 

--
View this message in context: http://camel.465427.n5.nabble.com/Documentation-for-automatic-marshalling-and-unmarshalling-tp4255275p4258140.html
Sent from the Camel - Users mailing list archive at Nabble.com.