Using Property Placeholders for Any Kind of Attribute in the XML DSL in Camel

Solution Verified - Updated -

Issue

  • How to configure non-string attributes within the Camel XML DSL dynamically using property placeholders?
  • When you try to configure a non-string attribute like timeout dynamically (through property file) you may face error like not a valid integer value for timeout
  • Placeholders do not work for non-string values directly

  • We often use pollEnrich in our routes and we need to set different timeouts. At the moment, in blueprint route, we can only set timeout as an int value, directly:

<pollEnrich timeout="50000">
                <simple></simple>
</pollEnrich>

But we would like to be able to change this value dinamically from properties and then write something like:

<pollEnrich timeout="${pollEnrichTimeout}">
                <simple></simple>
</pollEnrich>
  • Here ${pollEnrichTimeout} is defined outside the route and we can adjust it as needed without the need to re-deploy the route.
  • Tried both ${} and { {} } placeholder but when Fuse try to deploy the route it fails and says that it is not a valid integer value for timeout.

Environment

  • Red hat JBoss Fuse
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content