Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The property placeholders is also supported in many of the Camel Spring XML tags such as <package>, <packageScan>, <contextScan>, <jmxAgent>, <endpoint>, <routeBuilder>, <proxy> and the others.

The example below has property placeholder in the <jmxAgent> tagExample:

Code Block
languagexml
titleUsing property placeholders in the <jmxAgent> tag
<camelContext xmlns="http://camel.apache.org/schema/spring">
    <propertyPlaceholder id="properties" location="org/apache/camel/spring/jmx.properties"/>

    <!-- we can use propery placeholders when we define the JMX agent -->
    <jmxAgent id="agent" registryPort="{{myjmx.port}}" disabled="{{myjmx.disabled}}"
              usePlatformMBeanServer="{{myjmx.usePlatform}}"
              createConnector="true"
              statisticsLevel="RoutesOnly"
              useHostIPAddress="true"/>

    <route id="foo" autoStartup="false">
        <from uri="seda:start"/>
        <to uri="mock:result"/>
    </route>
</camelContext>

You can also define property placeholders in the various attributes on the <camelContext> tag such as trace as shown hereExample:

Code Block
languagexml
titleUsing property placeholders in the attributes of <camelContext>
<camelContext trace="{{foo.trace}}" xmlns="http://camel.apache.org/schema/spring">
    <propertyPlaceholder id="properties" location="org/apache/camel/spring/processor/myprop.properties"/>

    <template id="camelTemplate" defaultEndpoint="{{foo.cool}}"/>

    <route>
        <from uri="direct:start"/>
        <setHeader headerName="{{foo.header}}">
            <simple>${in.body} World!</simple>
        </setHeader>
        <to uri="mock:result"/>
    </route>
</camelContext>

...

In the example below we use the prop prefix for the namespace http://camel.apache.org/schema/placeholder by which we can use the prop prefix in the attributes in the XML DSLs. Notice how we use that in the Multicast to indicate that the option stopOnException should be the value of the placeholder with the key stop.

...