When I am trying to configure a new direct-Endpoint in Apache Camel, the configure()-Method of my RouteBuilder does not launch and I can not figure out the reason.
I have a Method configureRESTRoute(), which I have implemented in the following way:
private RouteBuilder configureRESTRoute(DataSource ds) {
RouteBuilder restRoute = new RESTRoute() {
@Override
public void configure() throws Exception {
from("direct:" + ds.getConfig().get("SOURCENAME"))
.log("----Configuring new REST Route----: " + "direct:" + ds.getConfig().get("SOURCENAME"))
.setHeader(Exchange.HTTP_PATH, simple((String) ds.getConfig().get("HTTP_PATH")))
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
.to("http4:" + ds.getConfig().get("HTTP_HOST"))
.log("----Successfully configured----");
}
};
return restRoute;
}
The DataSource class contains a Map of configuration details for a particular Datasource. In this method I am trying to build a Route which is later on added to the CamelContext. Currently it returns an empty Route, because the configure()-Method is skipped. Unfortunately there is no Exception thrown or any other kind of Error Message.
configure()method will be called once theRouteBuilderis added to Context. It is called as part of methodContext#addRoutes. - Bedla