I am using camel 2.1.0 cache component, and I am confused how I can use
custom objects with cache?

It seems to me that for every object I would want to use, I will have to
register TypeConverter for those classes? Is that assumption correct? 

I think it is due to following code in CacheProducer.java, which tries to
convert payload into InputStream?

InputStream is =
exchange.getContext().getTypeConverter().convertTo(InputStream.class, body);
        
        // Read InputStream into a byte[] buffer
        byte[] buffer = new byte[is.available()];
        int n = is.available();
        for (int j = 0; j < n; j++) {
            buffer[j] = (byte)is.read();
        }        

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 InputStream. Or was there any specific reason to do so?

I quickly modified Producer and it seems to work fine, please let me know
and I would be happy to provide the patch.

Thanks!
-- 
View this message in context: 
http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27026756.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to