On Thu, Dec 3, 2009 at 1:32 AM, mumbly <[email protected]> wrote: > > I'm talking about on demand triggering. Basically, I want to be able to > trigger a route programatically from within my code. I'm using quartz > already for certain batch processing. I'm just trying to understand how the > items I listed differ, whether they are the set you'd want to use for on > demand triggering and whether the ProducerTemplate is the right way to go > about that. >
Its easier in 2.1 as you can create routes which aren't started when Camel starts http://camel.apache.org/configuring-route-startup-ordering-and-autostartup.html And you can assign the route an id using .routeId in Java DSL or just "id" attribute in XML. Then you can manually start that route from JMX, Java code etc. CamelContext context = ... context.startRoute("theIdOfYourRoute"); context.stopRoute("theIdOfYourRoute"); > --Tim > > > Dragisa Krsmanovic wrote: >> >> It depends what you mean by 'triggering'. >> >> If you want to automatically send a message to a queue at specific >> intervals you can use Quartz component. >> >> For example, to send a "Hello World" message every 3 minutes: >> >> from("quartz://myCron?cron=0+0/3+*+*+*+?") >> .setBody(constant("Hello World")) >> .to(destination); >> >> Where destination can be anything ("direct:myQueue", "activemq:myQueue" >> etc.) >> >> >> >> On Wed, 2009-12-02 at 14:00 -0800, mumbly wrote: >>> While many of our processes are triggered by some external event (timer, >>> file >>> transfers, emails, web/REST/SOAP requests), there are a number of >>> instances >>> where we want to trigger a route from within our code. I'm trying to >>> understand how Camel allows me to do this and what the recommended >>> practices/patterns for this type of interaction are. >>> >>> I see a handful of components which seem like they would meet the >>> criteria >>> for trigger, but I'm not clear on which I should use. Basically I'm >>> looking >>> at: >>> >>> * direct >>> * jms >>> * seda >>> * vm >>> >>> It seems to me like they are similar, but it is unclear which are best >>> under >>> what conditions. Is there some document comparing the pros and cons and >>> potential use cases for these transports in non-test circumstances? >>> >>> And is the general pattern of direct triggering to use a >>> ProducerTemplate? >>> It felt a bit like this was mainly for testing, but I don't see other >>> methods used in the examples (or for that matter, I don't recall seeing >>> ProducerTemplate in non-test code, though I haven't searched too >>> closely). >>> >>> Basically, just trying to get some guidance as to the recommended >>> practice. >>> >>> Thanks. >>> >>> --Tim >> >> >> -- >> Dragisa Krsmanovic >> Java Developer >> Public Library of Science >> http://www.plos.org >> >> >> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> This email is confidential to the intended recipient. If you have received >> it in error, please notify the sender and delete it from your system. Any >> unauthorized use, disclosure or copying is not permitted. The views or >> opinions presented are solely those of the sender and do not necessarily >> represent those of Public Library of Science unless otherwise specifically >> stated. Please note that neither Public Library of Science nor any of its >> agents accept any responsibility for any viruses that may be contained in >> this e-mail or its attachments and it is your responsibility to scan the >> e-mail and attachments (if any). >> >> >> > > -- > View this message in context: > http://old.nabble.com/Best-Practices-for-Triggering-Routes-from-Code-tp26617252p26619145.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
