You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Stefan Krause <st...@qaware.de> on 2013/08/28 11:42:09 UTC

Caching POJOs (no serializable and no InputStream)

Currently I migrating a large application to Camel. In the past we use
ehCache directly and store complexe
nested data-structures as POJOs. The objects doesn't implement Serializable
interface.

The ehCache accept both, Serializable instances and normal POJO objects. But
the Camel CacheProducer always tries to convert Objects to InputStream. This
fails in our case because no matching TypeConverter exits. 

Some years ago this was already a topic here (
camel-cache-Using-Objects-for-cache
<http://camel.465427.n5.nabble.com/camel-cache-Using-Objects-for-cache-td477437.html> 
), but opening question:
/
Looking at EHCache API, it can support any object as long as it is
serializable, so camel-cache component should not try to convert payload
into byte[]. Or was there any specific reason to do so? /

wasn't answered. So again: Does there any reason why CacheProducer wants to
store a byte[] instead the object.

For now we will replace the Camel CacheProducer. 



--
View this message in context: http://camel.465427.n5.nabble.com/Caching-POJOs-no-serializable-and-no-InputStream-tp5738138.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Caching POJOs (no serializable and no InputStream)

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

Yeah sounds like an improvement can be made. Feel free to log a JIRA.
Also we love contributions so you are welcome to work on a patch.
http://camel.apache.org/contributing.html

On Wed, Aug 28, 2013 at 11:42 AM, Stefan Krause <st...@qaware.de> wrote:
> Currently I migrating a large application to Camel. In the past we use
> ehCache directly and store complexe
> nested data-structures as POJOs. The objects doesn't implement Serializable
> interface.
>
> The ehCache accept both, Serializable instances and normal POJO objects. But
> the Camel CacheProducer always tries to convert Objects to InputStream. This
> fails in our case because no matching TypeConverter exits.
>
> Some years ago this was already a topic here (
> camel-cache-Using-Objects-for-cache
> <http://camel.465427.n5.nabble.com/camel-cache-Using-Objects-for-cache-td477437.html>
> ), but opening question:
> /
> Looking at EHCache API, it can support any object as long as it is
> serializable, so camel-cache component should not try to convert payload
> into byte[]. Or was there any specific reason to do so? /
>
> wasn't answered. So again: Does there any reason why CacheProducer wants to
> store a byte[] instead the object.
>
> For now we will replace the Camel CacheProducer.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Caching-POJOs-no-serializable-and-no-InputStream-tp5738138.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Caching POJOs (no serializable and no InputStream)

Posted by ganga_camel <ga...@gmail.com>.
Hi,

By having the pojo implement Serializable, I was successfully able to add
pojo's into cache and retrieve them back without any type conversion.

-Ganga



--
View this message in context: http://camel.465427.n5.nabble.com/Caching-POJOs-no-serializable-and-no-InputStream-tp5738138p5778543.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Caching POJOs (no serializable and no InputStream)

Posted by ganga_camel <ga...@gmail.com>.
Hi,

Was there a patch implemented for this issue. I also have a case where I
need to add Pojo Objects into Cache and am not able to do so unless I
convert the Pojo to a String

If no fix was implemented, is there a work around to achieve this?

Appreciate response.



--
View this message in context: http://camel.465427.n5.nabble.com/Caching-POJOs-no-serializable-and-no-InputStream-tp5738138p5778541.html
Sent from the Camel - Users mailing list archive at Nabble.com.