Hi Guys Thanks for your reply. I do stop route using API.I call context.stopRoute() and context.removeRoute() using routeid. Here is my routebuilder.To be honest i have a Suspicion on "onException" DSL.Iam not so sure.Let me know what you guys think
===================================================================== public void startRoute(CamelContext context, final String name, final String eventId) throws Exception { context.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { onException(AddEventNotFoundException.class).handled(true) .setHeader(Exchange.HTTP_METHOD, constant(org.apache.camel.component.http4.HttpMethods.GET)) .recipientList(simple(liveEventUrlForOpenEvent, String.class)) .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD)) .setHeader(CacheConstants.CACHE_KEY, header("eventid")) .convertBodyTo(String.class, "UTF-8") .to("cache://LiveCache") .to("log:CACHEREFRESHEDFROMEXTERNALAPI?level=WARN"); onException(Throwable.class).handled(true).useOriginalMessage().to("log:com.unibet.dynaroutebuilder.DynamicRouteStarter?level=ERROR&showException=true&showCaughtException=true&showStackTrace=true"); this.getContext().getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, "true"); this.getContext().getProperties().put(Exchange.LOG_DEBUG_BODY_MAX_CHARS, "100000"); this.getContext().getProperties().put(Exchange.MAXIMUM_CACHE_POOL_SIZE, "50"); fromF("amqp:queue:%s", name) .setHeader("eventid", constant(eventId)) .process(protoBufMessageProcessor).routeId(name) .choice() .when(header("messagetype").isEqualTo(ProtoMessageType.ADD_BET_OFFER)) .marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new AddEventUpdateProcessor()) .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_ADD)) .setHeader(CacheConstants.CACHE_KEY, header("eventid")) .to("log:ADD_OFFER") .to("cache://LiveCache") .when(header("messagetype").isEqualTo(ProtoMessageType.REMOVE_BET_OFFER)) .marshal(jacksonDataFormatProcessor.getJacksonDataFormat()).process(new RemoveEventUpdateProcessor()) .setHeader(CacheConstants.CACHE_OPERATION, constant(CacheConstants.CACHE_OPERATION_UPDATE)) .setHeader(CacheConstants.CACHE_KEY, header("eventid")) .to("log:REMOVE_OFFER") .to("cache://LiveCache") .otherwise() .to("log:unhandledevent"); } }); } -- View this message in context: http://camel.465427.n5.nabble.com/ProducerCache-memory-leak-tp5108206p5109713.html Sent from the Camel - Users mailing list archive at Nabble.com.