I think you would get into a recusion this way and end up with stack overflow. You should try http://camel.apache.org/dynamic-router.html
Best regards, Vitalii Tymchyshyn 13 жовт. 2016 р. 18:31 "Goyal, Arpit" <arpit.go...@sap.com> пише: > Hi, > > We currently are on 2.16.3 version and can't use the loop function (part > of 2.17). So we have the following routes based on which we create sort of > loop with switch case. Now we are worried about the performance (when we > see stacktrace of camel processing) > > Route 1: from("direct:s1).to("read one page of data").process("process > one page").to("direct:s2"); > > Route 2: from("direct:s2").toD("go to external source").when("are more > pages left").to("direct:s1").otherwise().process("end processing"); > > Now if there are thousands of pages, it is possible that this loop creates > lot of objects in memory & can create performance issue? Is there a way for > Camel to be told, before going to route 1 again, forget all the past? Is > disabling HISTORY would solve that? > > Regards, > Arpit. >