Claus et al,

Thanks for the replies.  I have it working when I do this:

  <camelContext xmlns="http://camel.apache.org/schema/spring";>
    <propertyPlaceholder id="properties"
location="file:/usr/local/whatever/config/whatever.properties"/>
  </camelContext>

...but I also have this in my app context, so that my beans can use
${...}in their configuration:

  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location"
value="file:/usr/local/whatever/config/whatever.properties"/>
  </bean>

It seems wasteful to me to have to grab the same properties file twice.  Do
you know of a way around this, where I could share the same instance of
Properties for both needs?

I've seen the "ref:" syntax, where it refers to a Properties bean...but
unfortunately Spring's PropertyPlaceholderConfigurer itself doesn't act as a
Properties instance.

There's probably something simple I'm missing.  Any ideas?

The other case I'm wondering about is when properties are JNDI-based, such
as:

  <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
      <bean class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="whateverProperties"/>
        <property name="resourceRef" value="true"/>
      </bean>
    </property>
  </bean>

I tried this but it didn't work:

<propertyPlaceholder id="properties" location="ref:whateverProperties"/>

Is there way for Camel's properties component to reference
"whateverProperties" from JNDI?

These are NON-critical issues, that's for sure...I don't mind having the
duplicate Properties instances.  It could be a lot worse.  But I've love to
avoid it if there's an easy way.

Thanks,
Dan


On Sat, Jan 8, 2011 at 6:42 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:

> On Sat, Jan 8, 2011 at 12:07 PM, Tarjei Huse <tar...@scanmine.com> wrote:
> > 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
>
> Yes and endpoints uri which is resolved by CamelContext supports the
> Camel property placeholders feature.
>
>
> >> Dan
> >>
> >> On Sat, Jan 8, 2011 at 5:23 AM, Tarjei Huse <tar...@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
> >
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cib...@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Reply via email to