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="http://camel.apache.org/schema/spring";>
    <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="com.foo.ConfigMgr"/>
  <camelContext xmlns="http://camel.apache.org/schema/spring";>
    <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: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
<http://www.linkedin.com/pub/robert-simmons/40/852/a39>*

Reply via email to