camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henryk Konsek <hekon...@gmail.com>
Subject Re: How to force http consuming route to run only once?
Date Mon, 21 Jan 2013 15:23:54 GMT
> 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

Mime
View raw message