camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Custom Properties Placeholder Implementations?
Date Wed, 23 Apr 2014 07:15:40 GMT

Yeah for spring xml I would look into either using the spring's bridge
property placeholder, and then implement your database lookup as if it
was a pure spring problem, and how to integrate that with spring's
property placeholder magic.

An alternative is the Camel way and implement a custom

and have it extend the default resolver, if you need the regular ones
as well, eg to load .properties files from classpath/file etc.

And then define a <bean id="properties"
class=""> and
configure it to use your custom resolver class.

Though I would like to make that even easier so you would just define
your custom <bean> for the resolver, and have Camel's properties
component auto lookup and use yours as well out of the box. Like we
can do for:

And we have a few JIRA tickets already logged to improve the Camel's
properties component.

On Wed, Apr 23, 2014 at 8:51 AM, kraythe . <> wrote:
> Greetings, I am currently using java DSL and have been investigating Fuse
> and Fabric8 as possible alternatives.  Currently I have a route that does
> something like the following:
>     final String cron =
> this.config.automationCasesDBMonitorCron().replaceAll(" ", "+");
>     final String quartzURI =
> "quartz://case_automation/processAutomationCasesFromDB?cron=" + cron;
>     fromStandard(quartzURI)
>         .routeId(ROUTE_ID_ETL_MONITOR_TIMER) // timer trigger
>         .transacted(TxnHelper.KEY_TXNPOLICY_REQUIRED) // make the route
> transacted
>         .to(InOnly, endpointAMQ(this.config.queueETLCheckEvent())); // put
> an event to be consumed
> As you can see, I fetch the names of queues and cron trigger configs from a
> configuration object. The actual config class goes to a database to get the
> configuration but that is not relevant to the question. The question is how
> can I implement something like this inside the spring DSL (which I am
> admittedly unfamiliar with). Currently I am trying to cross code my routes
> and for this one I have the following:
>   <camelContext xmlns="">
>     <route id="ETLMonitorTimer">
>       <from
> uri="quartz://case_automation/processAutomationCasesFromDB?cron="/>
>       <transacted ref="REQUIRED"/>
>       <to uri="activemq:queue:"/>
>     </route>
>   </camelContext>
> As you can see I don't have the cron trigger or the destination queue that
> I get normally from the config file so I am at a bit of a loss as to how to
> accomplish this. I was thinking with a property placeholder i could do
> something like this:
>   <bean id="configBean" class=""/>
>   <camelContext xmlns="">
>     <propertyPlaceholder ref="configBean"/>
>     <route id="ETLMonitorTimer">
>       <from
> uri="quartz://case_automation/processAutomationCasesFromDB?cron={{etl_monitor_cron}}"/>
>       <transacted ref="REQUIRED"/>
>       <to uri="activemq:queue:{{event_queue}}"/>
>     </route>
>   </camelContext>
> But I may be way off base on how to do that. I confess I have always
> thought the Spring XML DSL to be much less flexible and powerful than the
> Java DSL but I am open to being proven wrong. :)
> So any help here? Thanks a bunch.
> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
> *LinkedIn: **
> <>*

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:

View raw message