You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by druminski <dr...@gmail.com> on 2012/12/10 11:43:48 UTC
New camel component which dynamically adds routes when it starts.
Hello,
I am working on a new camel component. The Purpose of the new component is
to simplify routes like this:
from("ref:myQueue")
.to("nmr:nmrEndpoint");
from("nmr:nmrEndpoing")
.("mock:result");
To route like this:
from("nmrref:myQueue?nmr=nmrEndpoint")
.to("mock:result");
So I would like to add dynamically two routes (which send and receive
exchanges from "nmr" component) when "nmrref" component/consumer starts.
At the moment I have NmrRefConsumer class which extends DefaultConsumer. The
doStart() method is overriden:
@Override
protected void doStart() throws Exception {
super.doStart();
RouteBuilder routeBuilder = new RouteBuilder() {
@Override
public void configure() throws Exception {
from("ref:" + refAddr)
.to("nmr:" + nmrAddr);
from("nmr:" + nmrAddr)
.process(getProcessor());
}
};
endpoint.getCamelContext().addRoutes(routeBuilder);
for(RouteDefinition routeDefinition :
routeBuilder.getRouteCollection().getRoutes()) {
endpoint.getCamelContext().startRoute(routeDefinition);
}
}
But it looks like this dynamic routes doesn't start in camelContext. Do you
know why and how can I fix this?
Thanks for reply.
Best regards
Lukasz Druminski
--
View this message in context: http://camel.465427.n5.nabble.com/New-camel-component-which-dynamically-adds-routes-when-it-starts-tp5723833.html
Sent from the Camel - Users mailing list archive at Nabble.com.