Thanks Willem, thanks Henryk for your suggestions.

Will try that to find out what makes most sense.

In fact, I tried the following which seemed to work
from("timer:httpRequestTrigger?repeatCount=1").to("http..


Isthere actually a real use case where from(http://...) makes sense?

Whats are the reasons to prefer 
from(...).enrich("http://...";).to("file://...")
to
from(...).to("http://...";).to("file://...")

For this question, RTFM would be a valid answeri guess...but maybe someone 
could give a brief answer, please?
(as I didn't find an obvious reason on http://camel.apache.org/http.html)


 
Thank your for your comments

kind regards,
Christian


________________________________
 Von: Henryk Konsek <hekon...@gmail.com>
An: users@camel.apache.org 
Gesendet: 16:23 Montag, 21.Januar 2013
Betreff: Re: How to force http consuming route to run only once?
 
> I think you can change your route from pulling request to direct producer 
> mode.

Just a little addition to Willem's answer.

If you need to issue HTTP request on demand (for example once) do not
use HTTP pull consumer, as you don't want to scan the endpoint
continuously. Instead trigger the HTTP enricher [1] on some event.

from(...).enrich("http://...";).to("file://...")
or
from(...).to("http://...";).to("file://...")

Some event sources you might be interested in:

___DIRECT___ [2]
Route:
from("direct:httpRequest").enrich("http://...";)...

Client:
producerTemplate.sendBody("direct:httpRequest", new MyHttpRequest())


___TIMER (ONCE)___ [3]

Route:
from("timer:httpRequestTrigger?repeatCount=1").enrich("http://...";)...

No client code is needed in this case.


___GUAVA EVENT BUS___ [4]
Route:
from("guava-eventbus:httpRequestBus?eventClass=MyHttpRequest").enrich("http://...";)...

Client:
@Inject EventBus httpRequestBus;
...
httpRequestBus.post(new MyHttpRequest())
_______________________

Best regards.


[1] http://camel.apache.org/content-enricher.html
[2] http://camel.apache.org/direct.html
[3] http://camel.apache.org/timer.html
[4] http://camel.apache.org/guava-eventbus.html

Reply via email to