You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by tide08 <sa...@yahoo.com> on 2010/01/06 02:14:35 UTC

camel-cache: Using Objects for cache

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.


Re: camel-cache: Using Objects for cache

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

No problem. I will clean out the other caches... I did not realize that
these were not commented out :)

Cheers,

Ashwin....


tide08 wrote:
> 
> Thanks Claus! ArtifactID says springsource is it some customized version
> of ehCache we are using? Reason I am asking is that I have conflict with
> hibernate and I need to exclude ehCache dependency from either one of
> these.
> 
> Also, I had another suggestion for cache component:
> 
> - Clean up ehCache.xml to remove sample cache descriptions as these are
> redundant, specially the one's which use distributed cache. It requires
> one of the port to be open and does not work out of the box.
> - Exposing cache statistics thru jmx
> 
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>>
>>> Looks like Ashwin got on to this before I could submit mine.
>>>
>>> BTW..what version of ehCache does it use? It is not very clear from pom
>>> (and
>>> osgi is new to me)
>>>
>> 
>> Check the parent/pm.xml which have versions listed.
>> 
>> Otherwise do a mvn dependency:list in the component to see which
>> versions maven report.
>> [INFO]   
>> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
>> 
>> 
>>> Thanks!
>>>
>>>
>>> tide08 wrote:
>>>>
>>>> Thanks! I will reply back when patch is ready.
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I created a ticket for it
>>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>>
>>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>>> wrote:
>>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>>>> wrote:
>>>>>>> I think we can support the InputStream and Serializable object at
>>>>>>> the
>>>>>>> same
>>>>>>> time :)
>>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>>> part,
>>>>>>> if
>>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>>
>>>>>>> Any thought?
>>>>>>>
>>>>>>
>>>>>> Yeah my thought as well about the Serializable
>>>>>>
>>>>>>
>>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>>> submit
>>>>>>> the
>>>>>>> patch with a JIRA[1].
>>>>>>>
>>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>>
>>>>>>> Willem
>>>>>>>
>>>>>>>
>>>>>>> tide08 wrote:
>>>>>>>>
>>>>>>>> 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!
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


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


Re: camel-cache: Using Objects for cache

Posted by tide08 <sa...@yahoo.com>.
Thanks Ashwin, EHCache has MBean which exposes all the statistics. I guess,
for now I can just expose it myself to mbean server.

Thanks for all the help :)



Ashwin Karpe wrote:
> 
> Hi,
> 
> The other request regarding exposing cache statistics is a little more
> involved.
> 
> I have created a Jira entry for it and will try and add this feature in
> due course.
> 
> Cheers,
> 
> Ashwin...
> 
> 
> tide08 wrote:
>> 
>> Thanks Claus! ArtifactID says springsource is it some customized version
>> of ehCache we are using? Reason I am asking is that I have conflict with
>> hibernate and I need to exclude ehCache dependency from either one of
>> these.
>> 
>> Also, I had another suggestion for cache component:
>> 
>> - Clean up ehCache.xml to remove sample cache descriptions as these are
>> redundant, specially the one's which use distributed cache. It requires
>> one of the port to be open and does not work out of the box.
>> - Exposing cache statistics thru jmx
>> 
>> 
>> 
>> Claus Ibsen-2 wrote:
>>> 
>>> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>>>
>>>> Looks like Ashwin got on to this before I could submit mine.
>>>>
>>>> BTW..what version of ehCache does it use? It is not very clear from pom
>>>> (and
>>>> osgi is new to me)
>>>>
>>> 
>>> Check the parent/pm.xml which have versions listed.
>>> 
>>> Otherwise do a mvn dependency:list in the component to see which
>>> versions maven report.
>>> [INFO]   
>>> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
>>> 
>>> 
>>>> Thanks!
>>>>
>>>>
>>>> tide08 wrote:
>>>>>
>>>>> Thanks! I will reply back when patch is ready.
>>>>>
>>>>>
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I created a ticket for it
>>>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>>>
>>>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>>>> wrote:
>>>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang
>>>>>>> <wi...@gmail.com>
>>>>>>> wrote:
>>>>>>>> I think we can support the InputStream and Serializable object at
>>>>>>>> the
>>>>>>>> same
>>>>>>>> time :)
>>>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>>>> part,
>>>>>>>> if
>>>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>>>
>>>>>>>> Any thought?
>>>>>>>>
>>>>>>>
>>>>>>> Yeah my thought as well about the Serializable
>>>>>>>
>>>>>>>
>>>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>>>> submit
>>>>>>>> the
>>>>>>>> patch with a JIRA[1].
>>>>>>>>
>>>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>>>
>>>>>>>> Willem
>>>>>>>>
>>>>>>>>
>>>>>>>> tide08 wrote:
>>>>>>>>>
>>>>>>>>> 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!
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Claus Ibsen
>>>>>>> Apache Camel Committer
>>>>>>>
>>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>>> Open Source Integration: http://fusesource.com
>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> Claus Ibsen
>>> Apache Camel Committer
>>> 
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> 
>>> 
>> 
>> 
> 
> 

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


Re: camel-cache: Using Objects for cache

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

The other request regarding exposing cache statistics is a little more
involved.

I have created a Jira entry for it and will try and add this feature in due
course.

Cheers,

Ashwin...


tide08 wrote:
> 
> Thanks Claus! ArtifactID says springsource is it some customized version
> of ehCache we are using? Reason I am asking is that I have conflict with
> hibernate and I need to exclude ehCache dependency from either one of
> these.
> 
> Also, I had another suggestion for cache component:
> 
> - Clean up ehCache.xml to remove sample cache descriptions as these are
> redundant, specially the one's which use distributed cache. It requires
> one of the port to be open and does not work out of the box.
> - Exposing cache statistics thru jmx
> 
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>>
>>> Looks like Ashwin got on to this before I could submit mine.
>>>
>>> BTW..what version of ehCache does it use? It is not very clear from pom
>>> (and
>>> osgi is new to me)
>>>
>> 
>> Check the parent/pm.xml which have versions listed.
>> 
>> Otherwise do a mvn dependency:list in the component to see which
>> versions maven report.
>> [INFO]   
>> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
>> 
>> 
>>> Thanks!
>>>
>>>
>>> tide08 wrote:
>>>>
>>>> Thanks! I will reply back when patch is ready.
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I created a ticket for it
>>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>>
>>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>>> wrote:
>>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>>>> wrote:
>>>>>>> I think we can support the InputStream and Serializable object at
>>>>>>> the
>>>>>>> same
>>>>>>> time :)
>>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>>> part,
>>>>>>> if
>>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>>
>>>>>>> Any thought?
>>>>>>>
>>>>>>
>>>>>> Yeah my thought as well about the Serializable
>>>>>>
>>>>>>
>>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>>> submit
>>>>>>> the
>>>>>>> patch with a JIRA[1].
>>>>>>>
>>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>>
>>>>>>> Willem
>>>>>>>
>>>>>>>
>>>>>>> tide08 wrote:
>>>>>>>>
>>>>>>>> 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!
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


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


Re: camel-cache: Using Objects for cache

Posted by Ashwin Karpe <as...@progress.com>.
Hi Claus,

I fixed the sample cache creation issue and have checked in a patch
CAMEL-2363.

Cheers,

Ashwin...
 

Claus Ibsen-2 wrote:
> 
> On Wed, Jan 13, 2010 at 7:19 PM, tide08 <sa...@yahoo.com> wrote:
>>
>> Thanks Claus! ArtifactID says springsource is it some customized version
>> of
>> ehCache we are using? Reason I am asking is that I have conflict with
>> hibernate and I need to exclude ehCache dependency from either one of
>> these.
>>
> 
> Its the OSGi problem that it often cannot use maven jars out of the
> box. So SpringSource creates their own .jar that works in their OSGi
> server.
> IMHO that is a big pain with OSGi as you need to keep up to date with
> releases.
> 
> Many projects don't release their .jars as OSGi compliant bundles.
> 
> It should be possible to use a never version and then let the camel
> feature for camel-cache use that Spring OSGi compliant .jar.
> Just that they are API compatible.
> 
> 
>> Also, I had another suggestion for cache component:
>>
>> - Clean up ehCache.xml to remove sample cache descriptions as these are
>> redundant, specially the one's which use distributed cache. It requires
>> one
>> of the port to be open and does not work out of the box.
>>
> 
> Can you pin point the problem.
> 
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>>>
>>>> Looks like Ashwin got on to this before I could submit mine.
>>>>
>>>> BTW..what version of ehCache does it use? It is not very clear from pom
>>>> (and
>>>> osgi is new to me)
>>>>
>>>
>>> Check the parent/pm.xml which have versions listed.
>>>
>>> Otherwise do a mvn dependency:list in the component to see which
>>> versions maven report.
>>> [INFO]
>>> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
>>>
>>>
>>>> Thanks!
>>>>
>>>>
>>>> tide08 wrote:
>>>>>
>>>>> Thanks! I will reply back when patch is ready.
>>>>>
>>>>>
>>>>>
>>>>> Claus Ibsen-2 wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I created a ticket for it
>>>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>>>
>>>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>>>> wrote:
>>>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang
>>>>>>> <wi...@gmail.com>
>>>>>>> wrote:
>>>>>>>> I think we can support the InputStream and Serializable object at
>>>>>>>> the
>>>>>>>> same
>>>>>>>> time :)
>>>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>>>> part,
>>>>>>>> if
>>>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>>>
>>>>>>>> Any thought?
>>>>>>>>
>>>>>>>
>>>>>>> Yeah my thought as well about the Serializable
>>>>>>>
>>>>>>>
>>>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>>>> submit
>>>>>>>> the
>>>>>>>> patch with a JIRA[1].
>>>>>>>>
>>>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>>>
>>>>>>>> Willem
>>>>>>>>
>>>>>>>>
>>>>>>>> tide08 wrote:
>>>>>>>>>
>>>>>>>>> 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!
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Claus Ibsen
>>>>>>> Apache Camel Committer
>>>>>>>
>>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>>> Open Source Integration: http://fusesource.com
>>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27148797.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


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


Re: camel-cache: Using Objects for cache

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jan 13, 2010 at 7:19 PM, tide08 <sa...@yahoo.com> wrote:
>
> Thanks Claus! ArtifactID says springsource is it some customized version of
> ehCache we are using? Reason I am asking is that I have conflict with
> hibernate and I need to exclude ehCache dependency from either one of these.
>

Its the OSGi problem that it often cannot use maven jars out of the
box. So SpringSource creates their own .jar that works in their OSGi
server.
IMHO that is a big pain with OSGi as you need to keep up to date with releases.

Many projects don't release their .jars as OSGi compliant bundles.

It should be possible to use a never version and then let the camel
feature for camel-cache use that Spring OSGi compliant .jar.
Just that they are API compatible.


> Also, I had another suggestion for cache component:
>
> - Clean up ehCache.xml to remove sample cache descriptions as these are
> redundant, specially the one's which use distributed cache. It requires one
> of the port to be open and does not work out of the box.
>

Can you pin point the problem.

>
>
> Claus Ibsen-2 wrote:
>>
>> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>>
>>> Looks like Ashwin got on to this before I could submit mine.
>>>
>>> BTW..what version of ehCache does it use? It is not very clear from pom
>>> (and
>>> osgi is new to me)
>>>
>>
>> Check the parent/pm.xml which have versions listed.
>>
>> Otherwise do a mvn dependency:list in the component to see which
>> versions maven report.
>> [INFO]
>> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
>>
>>
>>> Thanks!
>>>
>>>
>>> tide08 wrote:
>>>>
>>>> Thanks! I will reply back when patch is ready.
>>>>
>>>>
>>>>
>>>> Claus Ibsen-2 wrote:
>>>>>
>>>>> Hi
>>>>>
>>>>> I created a ticket for it
>>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>>
>>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>>> wrote:
>>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>>>> wrote:
>>>>>>> I think we can support the InputStream and Serializable object at the
>>>>>>> same
>>>>>>> time :)
>>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>>> part,
>>>>>>> if
>>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>>
>>>>>>> Any thought?
>>>>>>>
>>>>>>
>>>>>> Yeah my thought as well about the Serializable
>>>>>>
>>>>>>
>>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>>> submit
>>>>>>> the
>>>>>>> patch with a JIRA[1].
>>>>>>>
>>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>>
>>>>>>> Willem
>>>>>>>
>>>>>>>
>>>>>>> tide08 wrote:
>>>>>>>>
>>>>>>>> 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!
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Claus Ibsen
>>>>>> Apache Camel Committer
>>>>>>
>>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>>> Open Source Integration: http://fusesource.com
>>>>>> Blog: http://davsclaus.blogspot.com/
>>>>>> Twitter: http://twitter.com/davsclaus
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27148797.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel-cache: Using Objects for cache

Posted by tide08 <sa...@yahoo.com>.
Thanks Claus! ArtifactID says springsource is it some customized version of
ehCache we are using? Reason I am asking is that I have conflict with
hibernate and I need to exclude ehCache dependency from either one of these.

Also, I had another suggestion for cache component:

- Clean up ehCache.xml to remove sample cache descriptions as these are
redundant, specially the one's which use distributed cache. It requires one
of the port to be open and does not work out of the box.



Claus Ibsen-2 wrote:
> 
> On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>>
>> Looks like Ashwin got on to this before I could submit mine.
>>
>> BTW..what version of ehCache does it use? It is not very clear from pom
>> (and
>> osgi is new to me)
>>
> 
> Check the parent/pm.xml which have versions listed.
> 
> Otherwise do a mvn dependency:list in the component to see which
> versions maven report.
> [INFO]   
> net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile
> 
> 
>> Thanks!
>>
>>
>> tide08 wrote:
>>>
>>> Thanks! I will reply back when patch is ready.
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> Hi
>>>>
>>>> I created a ticket for it
>>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>>
>>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>>> wrote:
>>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>>> wrote:
>>>>>> I think we can support the InputStream and Serializable object at the
>>>>>> same
>>>>>> time :)
>>>>>> If the Message body is Serializable, we can skip the InputStream
>>>>>> part,
>>>>>> if
>>>>>> it's not, we can try to turn it into an InputStream.
>>>>>>
>>>>>> Any thought?
>>>>>>
>>>>>
>>>>> Yeah my thought as well about the Serializable
>>>>>
>>>>>
>>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>>> submit
>>>>>> the
>>>>>> patch with a JIRA[1].
>>>>>>
>>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>>
>>>>>> Willem
>>>>>>
>>>>>>
>>>>>> tide08 wrote:
>>>>>>>
>>>>>>> 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!
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Claus Ibsen
>>>>> Apache Camel Committer
>>>>>
>>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>>> Open Source Integration: http://fusesource.com
>>>>> Blog: http://davsclaus.blogspot.com/
>>>>> Twitter: http://twitter.com/davsclaus
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

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


Re: camel-cache: Using Objects for cache

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jan 13, 2010 at 12:32 AM, tide08 <sa...@yahoo.com> wrote:
>
> Looks like Ashwin got on to this before I could submit mine.
>
> BTW..what version of ehCache does it use? It is not very clear from pom (and
> osgi is new to me)
>

Check the parent/pm.xml which have versions listed.

Otherwise do a mvn dependency:list in the component to see which
versions maven report.
[INFO]    net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile


> Thanks!
>
>
> tide08 wrote:
>>
>> Thanks! I will reply back when patch is ready.
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> Hi
>>>
>>> I created a ticket for it
>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>>
>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>> wrote:
>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>> wrote:
>>>>> I think we can support the InputStream and Serializable object at the
>>>>> same
>>>>> time :)
>>>>> If the Message body is Serializable, we can skip the InputStream part,
>>>>> if
>>>>> it's not, we can try to turn it into an InputStream.
>>>>>
>>>>> Any thought?
>>>>>
>>>>
>>>> Yeah my thought as well about the Serializable
>>>>
>>>>
>>>>> BTW, any kind of contribution is welcome, so please feel free to submit
>>>>> the
>>>>> patch with a JIRA[1].
>>>>>
>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>
>>>>> Willem
>>>>>
>>>>>
>>>>> tide08 wrote:
>>>>>>
>>>>>> 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!
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel-cache: Using Objects for cache

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

The version of ehCache used is 1.6.2.

This is however modifiable to a later or earlier version.

Cheers,

Ashwin...


tide08 wrote:
> 
> Looks like Ashwin got on to this before I could submit mine.
> 
> BTW..what version of ehCache does it use? It is not very clear from pom
> (and osgi is new to me)
> 
> Thanks!
> 
> 
> tide08 wrote:
>> 
>> Thanks! I will reply back when patch is ready.
>> 
>> 
>> 
>> Claus Ibsen-2 wrote:
>>> 
>>> Hi
>>> 
>>> I created a ticket for it
>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>> 
>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>> wrote:
>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>> wrote:
>>>>> I think we can support the InputStream and Serializable object at the
>>>>> same
>>>>> time :)
>>>>> If the Message body is Serializable, we can skip the InputStream part,
>>>>> if
>>>>> it's not, we can try to turn it into an InputStream.
>>>>>
>>>>> Any thought?
>>>>>
>>>>
>>>> Yeah my thought as well about the Serializable
>>>>
>>>>
>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>> submit the
>>>>> patch with a JIRA[1].
>>>>>
>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>
>>>>> Willem
>>>>>
>>>>>
>>>>> tide08 wrote:
>>>>>>
>>>>>> 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!
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> Claus Ibsen
>>> Apache Camel Committer
>>> 
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> 
>>> 
>> 
>> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


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


Re: camel-cache: Using Objects for cache

Posted by Ashwin Karpe <as...@progress.com>.
Hi,

The version of ehCache used by camel-cache is 1.6.2. This can however be
modified to an earlier or later version.

Cheers,

Ashwin...
 

tide08 wrote:
> 
> Looks like Ashwin got on to this before I could submit mine.
> 
> BTW..what version of ehCache does it use? It is not very clear from pom
> (and osgi is new to me)
> 
> Thanks!
> 
> 
> tide08 wrote:
>> 
>> Thanks! I will reply back when patch is ready.
>> 
>> 
>> 
>> Claus Ibsen-2 wrote:
>>> 
>>> Hi
>>> 
>>> I created a ticket for it
>>> https://issues.apache.org/activemq/browse/CAMEL-2343
>>> 
>>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>>> wrote:
>>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>>> wrote:
>>>>> I think we can support the InputStream and Serializable object at the
>>>>> same
>>>>> time :)
>>>>> If the Message body is Serializable, we can skip the InputStream part,
>>>>> if
>>>>> it's not, we can try to turn it into an InputStream.
>>>>>
>>>>> Any thought?
>>>>>
>>>>
>>>> Yeah my thought as well about the Serializable
>>>>
>>>>
>>>>> BTW, any kind of contribution is welcome, so please feel free to
>>>>> submit the
>>>>> patch with a JIRA[1].
>>>>>
>>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>>
>>>>> Willem
>>>>>
>>>>>
>>>>> tide08 wrote:
>>>>>>
>>>>>> 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!
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>> 
>>> 
>>> 
>>> -- 
>>> Claus Ibsen
>>> Apache Camel Committer
>>> 
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>> 
>>> 
>> 
>> 
> 
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


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


Re: camel-cache: Using Objects for cache

Posted by tide08 <sa...@yahoo.com>.
Looks like Ashwin got on to this before I could submit mine.

BTW..what version of ehCache does it use? It is not very clear from pom (and
osgi is new to me)

Thanks!


tide08 wrote:
> 
> Thanks! I will reply back when patch is ready.
> 
> 
> 
> Claus Ibsen-2 wrote:
>> 
>> Hi
>> 
>> I created a ticket for it
>> https://issues.apache.org/activemq/browse/CAMEL-2343
>> 
>> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com>
>> wrote:
>>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>>> wrote:
>>>> I think we can support the InputStream and Serializable object at the
>>>> same
>>>> time :)
>>>> If the Message body is Serializable, we can skip the InputStream part,
>>>> if
>>>> it's not, we can try to turn it into an InputStream.
>>>>
>>>> Any thought?
>>>>
>>>
>>> Yeah my thought as well about the Serializable
>>>
>>>
>>>> BTW, any kind of contribution is welcome, so please feel free to submit
>>>> the
>>>> patch with a JIRA[1].
>>>>
>>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>>
>>>> Willem
>>>>
>>>>
>>>> tide08 wrote:
>>>>>
>>>>> 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!
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>> 
>> 
>> 
>> -- 
>> Claus Ibsen
>> Apache Camel Committer
>> 
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>> 
>> 
> 
> 

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


Re: camel-cache: Using Objects for cache

Posted by tide08 <sa...@yahoo.com>.
Thanks! I will reply back when patch is ready.



Claus Ibsen-2 wrote:
> 
> Hi
> 
> I created a ticket for it
> https://issues.apache.org/activemq/browse/CAMEL-2343
> 
> On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com> wrote:
>> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com>
>> wrote:
>>> I think we can support the InputStream and Serializable object at the
>>> same
>>> time :)
>>> If the Message body is Serializable, we can skip the InputStream part,
>>> if
>>> it's not, we can try to turn it into an InputStream.
>>>
>>> Any thought?
>>>
>>
>> Yeah my thought as well about the Serializable
>>
>>
>>> BTW, any kind of contribution is welcome, so please feel free to submit
>>> the
>>> patch with a JIRA[1].
>>>
>>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>>
>>> Willem
>>>
>>>
>>> tide08 wrote:
>>>>
>>>> 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!
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

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


Re: camel-cache: Using Objects for cache

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

I created a ticket for it
https://issues.apache.org/activemq/browse/CAMEL-2343

On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com> wrote:
>> I think we can support the InputStream and Serializable object at the same
>> time :)
>> If the Message body is Serializable, we can skip the InputStream part, if
>> it's not, we can try to turn it into an InputStream.
>>
>> Any thought?
>>
>
> Yeah my thought as well about the Serializable
>
>
>> BTW, any kind of contribution is welcome, so please feel free to submit the
>> patch with a JIRA[1].
>>
>> [1] http://issues.apache.org/activemq/browse/CAMEL
>>
>> Willem
>>
>>
>> tide08 wrote:
>>>
>>> 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!
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel-cache: Using Objects for cache

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang <wi...@gmail.com> wrote:
> I think we can support the InputStream and Serializable object at the same
> time :)
> If the Message body is Serializable, we can skip the InputStream part, if
> it's not, we can try to turn it into an InputStream.
>
> Any thought?
>

Yeah my thought as well about the Serializable


> BTW, any kind of contribution is welcome, so please feel free to submit the
> patch with a JIRA[1].
>
> [1] http://issues.apache.org/activemq/browse/CAMEL
>
> Willem
>
>
> tide08 wrote:
>>
>> 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!
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: camel-cache: Using Objects for cache

Posted by Willem Jiang <wi...@gmail.com>.
I think we can support the InputStream and Serializable object at the 
same time :)
If the Message body is Serializable, we can skip the InputStream part, 
if it's not, we can try to turn it into an InputStream.

Any thought?

BTW, any kind of contribution is welcome, so please feel free to submit 
the patch with a JIRA[1].

[1] http://issues.apache.org/activemq/browse/CAMEL

Willem


tide08 wrote:
> 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!