Hi, I think you need to add an option to let the KratiConsumer know the max size of data it should poll. BTW, it could be better to let the KratiConsumer choice the start point of keyIterator.
-- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Thursday, May 16, 2013 at 5:03 PM, matt.u wrote: > Camel KratiConsumer throw OutOfMemory like this: > Consumer Consumer[krati://notifications?operation=CamelKratiDelete] failed > polling endpoint: > Endpoint[krati://notifications?operation=CamelKratiDelete]. Will try again > at next poll. Caused by: [java.lang.OutOfMemoryError - Java heap space] > java.lang.OutOfMemoryError: Java heap space > at java.util.ArrayList.<init>(ArrayList.java:112) > at > krati.store.DefaultDataStoreHandler.extractKeys(DefaultDataStoreHandler.java:226) > at krati.store.DataStoreKeyIterator.findNext(DataStoreKeyIterator.java:82) > at krati.store.DataStoreKeyIterator.hasNext(DataStoreKeyIterator.java:52) > at > krati.store.ObjectStoreKeyIterator.hasNext(ObjectStoreKeyIterator.java:43) > at > org.apache.camel.component.krati.KratiConsumer.poll(KratiConsumer.java:58) > > I think the problem is KratiConsumer.poll(): > Iterator keyIterator = dataStore.keyIterator(); > while (keyIterator.hasNext()) {* //It's no limit, so use many > memory* > Object key = keyIterator.next(); > Object value = dataStore.get(key); > Exchange exchange = endpoint.createExchange(); > exchange.setProperty(KratiConstants.KEY, key); > exchange.getIn().setBody(value); > queue.add(exchange); > } > return queue.isEmpty() ? 0 : processBatch(CastUtils.cast(queue)); > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-KratiConsumer-throw-OutOfMemory-tp5732669.html > Sent from the Camel Development mailing list archive at Nabble.com > (http://Nabble.com).