Hi See this FAQ http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
You should create one instance of ProducerTemplate and keep it around. And you should remember to stop it after use, if you create a new instance all the time. In Camel 2.3 Camel will help shutdown the producer template you create with the API from CamelContext. On Tue, May 11, 2010 at 5:01 PM, dougly <[email protected]> wrote: > > Hi, > I have a route which uses the SEDA endpoint. After a week or two the JVM > would crash due to out of memory. When I use youkit to profile the JVM I see > a bunch of mbeanserver.NamedObject created overtime related to the seda > queue. Those mbeanserver.NamedObject are stored in a HashMap. > > Does anybody have experience with this issue? > Thanks > > Here is the route: > > onException(Exception.class).process(new Processor() { > �...@override > public void process(Exchange ex) throws Exception > { > System.out.println("Exception: " + ex.getIn().getBody()); > } > }); > > from("quartz://mail/mailReminder?cron=0/30+*+*+*+*+?").process(new > Processor() > { > �...@override > public void process(Exchange ex) throws Exception > { > System.out.println("Polling Exchange Server WS"); > List<ItemType> items = poller.getMailItems(); > ProducerTemplate prod = > getContext().createProducerTemplate(); > for (ItemType item : items) > { > prod.sendBody("seda:mail", item); > } > } > }); > > from("seda:mail") > // on completion, delete that email from exchange server > .onCompletion().onCompleteOnly() > .process(new Processor() > { > �...@override > public void process(Exchange exchange) throws Exception > { > ItemIdType itemId = > emailProcessor.deleteMessage(exchange); > poller.deleteItem(itemId); > } > }) > .end() > // this is the original route > .process( > new Processor() > { > �...@override > public void process(Exchange exchange) throws Exception > { > emailProcessor.process(exchange); > } > } > ).to("test-activemq:queue:" + queueName); > -- > View this message in context: > http://old.nabble.com/Out-of-Memory-Crash-with-Seda-%28Camel-2.1.0%29-tp28525274p28525274.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
