camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mumbly <mcner...@gmail.com>
Subject Re: Best Practices for Triggering Routes from Code
Date Thu, 03 Dec 2009 00:32:41 GMT

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.

--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.


Mime
View raw message