Quantcast
Channel: Apache Camel example to get data from HTTP source does not get - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Apache Camel example to get data from HTTP source does not get

$
0
0

To retrieve some open data from a remote web server to process, I'm trying out Apache Camel.

The problem is that it seems that the data is never received. I have tried the jetty, ahc and cxf components but can't get it to work. For example like this:

import org.apache.camel.CamelContext;import org.apache.camel.builder.RouteBuilder;import org.apache.camel.impl.DefaultCamelContext;public class CamelHttpDemo {  public static void main(final String... args) {    final CamelContext context = new DefaultCamelContext();      try {        context.addRoutes(new RouteBuilder() {          @Override          public void configure() throws Exception {            this.from("direct:start")                .to("ahc:http://camel.apache.org/")                .process(exchange -> {                  System.out.println(exchange);                });          }      });      context.start();      Thread.sleep(10000);      context.stop();    } catch (final Exception e) {      e.printStackTrace();    }  }}

No output is written so the line System.out.println(exchange); is never executed and I assume the data is not retrieved.

I'm using the most recent version of Apache Camel, 2.17.1.


Viewing all articles
Browse latest Browse all 2

Trending Articles