[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DynamicRouter annotation with Consume annotation -- still need a route to consume messages?

Hello, everyone.  I am using camel 2.19.2.  If I have a class like this:

public class MyDynamicRouter {
    @Consume(uri = "direct-vm:start")
    public String route() {
        ... routing logic goes here ...

Do I still need to add a route that consumes from "direct-vm:start"?  It
seems like I still need the route, since if I eliminate the route, and add
a bean (like the sparse example above) to the registry within the camel
context like this:

void initialize() {
    this.simpleRegistry = new SimpleRegistry();
    this.camelContext = new DefaultCamelContext(registry);
    registry.put("myDynamicRouter", new MyDynamicRouter());

If I try to send something to "direct-vm:start", I get an error that
nothing is consuming from that endpoint.  If this is expected behavior,
then what is the point of adding the @Consume annotation to the dynamic
router method?  The route that uses this bean is consuming from that
endpoint anyway because of from("direct-vm:start").

Thanks in advance.