If you are already familiar with the JPA API you can just invoke it from regular Java code. Then you dont need a 2nd Camel route.
But you can also start the 2nd route using Camel API. And if you want the 2nd route to stop by itself when its done, then this is discussed in the Camel in Action book chapter 13. In fact it talks about starting/stopping routes at runtime. You can also use a route policy which can dictate when a route should be active. In fact from Camel 2.6 we got some new stuff Ashwin wrote http://camel.apache.org/scheduledroutepolicy.html Ahswin its not in 2.5 due it was not included in the JAR (OSGi stuff filtered it out :( ) On Tue, Oct 26, 2010 at 5:32 PM, Prerna Kaul <[email protected]> wrote: > Hi All, > > I am trying to use the JPA endpoint as a consumer. However, I want to poll > from the database only once. The records returned to me should be distinct > in that sense. Is there an existing parameter on the endpoint that would > help me do that? > > My existing solution is this(in psuedo java DSL) - > Route 1: > from(quartz:interval=0).to(randomProcessor) > Route 2: > from(jpa).to(databaseProcessor) > In randomProcessor, we start the Route 2 using the camelContext and route > ID. > > > Is there a better way to do this? > > > --- > This communication may contain confidential and/or privileged information. > If you are not the intended recipient (or have received this communication > in error) please notify the sender immediately and destroy this > communication. Any unauthorized copying, disclosure or distribution of the > material in this communication is strictly forbidden. > > Deutsche Bank does not render legal or tax advice, and the information > contained in this communication should not be regarded as such. -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
