armandino armandino - 10 months ago 46
Java Question

Dynamic to(URI) in Camel

I'd like configure a Camel route where the

can be specified at runtime.

I tried the following:

public class Foo extends RouteBuilder {
public void configure() {
// the URI can point to different hosts

and then

ProducerTemplate pt = camelContext.createProducerTemplate();
pt.requestBodyAndHeader("direct:start", "someUri", "");

However the above doesn't work (Camel complains about not having a default Endpoint).

What's the best way to go about this?