You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Chris Toomey <ct...@gmail.com> on 2014/03/28 02:15:30 UTC

Type converter for serialized object?

I'm working on an app that's using akka camel (the akka camel extension) to
send/receive JMS messages to/from another application that is using Spring
Integration.

In our first baby steps in integration testing we're getting the following
exception when trying to convert a message whose body is a serialized
instance of an application-specific class C via
camelMessage.getBodyAs(C.class, ctx):

Caught exception: org.apache.camel.NoTypeConversionAvailableException: No
type converter available to convert from type: byte[] to the required type:
C

I've verified that the camel message body is the serialized object of type
C as I can deserialize it into the object in separate test code that I
wrote to check that.

Do the default type converters that Camel uses not include one that can
deserialize a serialized object?  If that's true, is there a type converter
that does this that I can include, or do I need to write a custom
converter?  Aren't serialized objects as message bodies quite a common use
case?

thx,
Chris

Re: Type converter for serialized object?

Posted by Chris Toomey <ct...@gmail.com>.
Thanks Willem, that's exactly what I needed.  I'm new to Camel and hadn't
realized there were multiple ways to do data transformation and had
prematurely found and tried to use type conversion.

I found this<http://stackoverflow.com/questions/14501119/which-camel-construct-is-suited-for-transforming>thread
on SO as well as chapter 3 and esp. table 3.1 in the Camel in Action
book were helpful in calling out the different options.

Chris



On Thu, Mar 27, 2014 at 8:01 PM, Willem Jiang <wi...@gmail.com>wrote:

> Hi,
>
> Camel has a serialisation data format can do this kind of work.
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.iteye.com (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
> On March 28, 2014 at 9:15:59 AM, Chris Toomey (ctoomey@gmail.com) wrote:
> > I'm working on an app that's using akka camel (the akka camel extension)
> to
> > send/receive JMS messages to/from another application that is using
> Spring
> > Integration.
> >
> > In our first baby steps in integration testing we're getting the
> following
> > exception when trying to convert a message whose body is a serialized
> > instance of an application-specific class C via
> > camelMessage.getBodyAs(C.class, ctx):
> >
> > Caught exception: org.apache.camel.NoTypeConversionAvailableException: No
> > type converter available to convert from type: byte[] to the required
> type:
> > C
> >
> > I've verified that the camel message body is the serialized object of
> type
> > C as I can deserialize it into the object in separate test code that I
> > wrote to check that.
> >
> > Do the default type converters that Camel uses not include one that can
> > deserialize a serialized object? If that's true, is there a type
> converter
> > that does this that I can include, or do I need to write a custom
> > converter? Aren't serialized objects as message bodies quite a common use
> > case?
> >
> > thx,
> > Chris
> >
>
>

Re: Type converter for serialized object?

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

Camel has a serialisation data format can do this kind of work.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On March 28, 2014 at 9:15:59 AM, Chris Toomey (ctoomey@gmail.com) wrote:
> I'm working on an app that's using akka camel (the akka camel extension) to
> send/receive JMS messages to/from another application that is using Spring
> Integration.
>  
> In our first baby steps in integration testing we're getting the following
> exception when trying to convert a message whose body is a serialized
> instance of an application-specific class C via
> camelMessage.getBodyAs(C.class, ctx):
>  
> Caught exception: org.apache.camel.NoTypeConversionAvailableException: No
> type converter available to convert from type: byte[] to the required type:
> C
>  
> I've verified that the camel message body is the serialized object of type
> C as I can deserialize it into the object in separate test code that I
> wrote to check that.
>  
> Do the default type converters that Camel uses not include one that can
> deserialize a serialized object? If that's true, is there a type converter
> that does this that I can include, or do I need to write a custom
> converter? Aren't serialized objects as message bodies quite a common use
> case?
>  
> thx,
> Chris
>