camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tarjei Huse <tar...@scanmine.com>
Subject Re: Dynamic URI with annotation-based POJOs?
Date Sat, 08 Jan 2011 11:07:40 GMT
On 01/08/2011 11:32 AM, Dan Checkoway wrote:
> Yeah, I've been digging into that.  It looks like I may be able to do
> something like this in the <camelContext>:
>
> <propertyPlaceholder id="propertes" location="ref:myJndiProperties" />
>
> And then use the {{...}} style property references on the URI?
Try. I think it will work on annotations as well.
T
> Dan
>
> On Sat, Jan 8, 2011 at 5:23 AM, Tarjei Huse <tarjei@scanmine.com> wrote:

>> Hi,
>> On 01/08/2011 10:59 AM, Dan Checkoway wrote:
>>> 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) {
>>>     ...
>>> }
>> Have you looked at the new property placeholder stuff in 2.3?
>>
>> http://davsclaus.blogspot.com/2010/02/property-placeholder-galore-in-apache.html
>>
>> I'm not sure if it works with annotations, but I've used it in a lot of
>> other places.
>> T
>>> Is this possible already and I just managed to miss it?  :-)  If not, is
>>> something like that in the works?
>>>
>>> Thanks,
>>> Dan
>>>
>>
>> --
>> Regards / Med vennlig hilsen
>> Tarjei Huse
>> Mobil: 920 63 413
>>
>>


-- 
Regards / Med vennlig hilsen
Tarjei Huse
Mobil: 920 63 413


Mime
View raw message