On Fri, Mar 19, 2010 at 8:55 AM, Norman Maurer <norman.mau...@googlemail.com> wrote: > Hi Claus, > > did I get it right ? > > http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/JMSSelectorPollingConsumer.java?view=markup > > Would be nice if you could have a look ... >
Yes it looks perfect. The only issue would be if an exception was thrown, eg consider using try .. finally > Thx, > Norman > > > 2010/3/18 Norman Maurer <norman.mau...@googlemail.com>: >> Jira Ticket created: >> >> https://issues.apache.org/activemq/browse/CAMEL-2558 >> >> Thx, >> Norman >> >> >> 2010/3/18 Claus Ibsen <claus.ib...@gmail.com>: >>> On Thu, Mar 18, 2010 at 12:58 PM, Norman Maurer <nor...@apache.org> wrote: >>>> Hi all, >>>> >>>> I'm using the ConsumerTemplate to consume messages from a ActiceMQ >>>> queue (using a selector for filtering). Everything seems to work >>>> without a problem but after some days I get an OOM Exception. (To be >>>> hornest the queue is empty all the time). When I remove the >>>> ConsumerTemplate stuff I don't see the problems. So I suspect there is >>>> something leakin.. >>>> >>>> Any idea howto track down this ? >>>> >>>> My code is here: >>>> >>>> http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/JMSSelectorPollingConsumer.java?view=markup >>>> >>>> I'm usin camel 2.3 SNAPSHOT.. >>>> >>> >>> Your consumer endpoint URI will be unique on each call since you use >>> System currentTimeMillis. >>> And hence the internal consumer cache is without any effect and a new >>> endpoint is created to consume from the JMS Broker. >>> The ConsumerTemplate has an internal LRUCache of 1000 elements. I >>> guess even with that to prevent high memory consumption your JVM hit a >>> limit before. >>> It would be more ideal if the endpoint could be reused and the >>> JMSSelector was dynamic. >>> >>> >>> I recon we need to expose easy cache size on the Consumer/Producer >>> Templates so you can set a lower size in your case. >>> >>> Could you create a JIRA ticket on this? >>> >>> >>> A workaround currently is to not use the consumer template but >>> creating the consumer manually and then doing the stop afterwards to >>> free resources. >>> Another workaround is to stop/start the consumer template once in a >>> while to free the cache. >>> >>> >>> But since you are on 2.3-SNAPSHOT you may want to wait for the fix and >>> try it out. >>> >>> >>> >>>> Thx, >>>> Norman >>>> >>> >>> >>> >>> -- >>> 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