Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Andrew Lygin for Apache Camel example to get data from HTTP source does not get

You need some message producer in your route to emit Exchange that would trigger the http component. Your route starts with direct:start which cannot emit new Exchanges, it just sits and waits for someone to initiate the process.

The easiest way to make your route work is to replace direct:start with some producer. For instance, replacing it with this timer .from("timer://foo?fixedRate=true&period=10000") will trigger your http-request once every 10 seconds.

If you want to initiate the request manually, you need to create a ProducerTemplate and use it to send a message to direct:start. That would be:

ProducerTemplate template = context.createProducerTemplate();template.sendMessage("direct:start", "Message body");

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles