camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Checkoway <dchecko...@gmail.com>
Subject Dynamic URI with annotation-based POJOs?
Date Sat, 08 Jan 2011 09:59:57 GMT
I'm generally a huge fan of annotation-driven stuff.  Here's one example
where my hands are tied, and I can't use annotations to do what I want to
do.  Let's say I have this:

@Consume(uri="activmeq:queue:whatever?concurrentConsumers=10")
public void onWhatever(String whatever) {
    ...
}

Now let's say I want the queue name ("stuff") and the # of
concurrentConsumers to be configurable via a properties file.  Up until now,
I've resorted to setting up the route manually with stuff like:

public class MyRouteBuilder extends RouteBuilder {
    @Value("${queueName}")
    String queueName;
    @Value("${concurrentConsumers}")
    int concurrentConsumers;

    public void configure() {
        from("activemq:queue:" + queueName + "?concurrentConsumers=" +
concurrentConsumers)
            .to(myWhateverBean, "onWhatever");
    }
}

Can anybody suggest an alternative way of using "dynamic" URIs with
annotation-based POJOs?  I would love, for example, to be able to do
something like this:

@Consume(uri="activmeq:queue:${queueName}?concurrentConsumers=${concurrentConsumers}")
public void onWhatever(String whatever) {
    ...
}

Is this possible already and I just managed to miss it?  :-)  If not, is
something like that in the works?

Thanks,
Dan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message