Search code examples
javaapache-camelspring-dsl

Camel:Spring-DSL:Multicats 'timeout' attribute from properties


I want to set timeout attribute in multicast tag from a external property file.

I can use properties without issue with {{property.name}} syntax in uri,etc definitions.

However below usage seems like not permitted. Any ideas how to work around / correct way of this?

<camel:camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">

    <propertyPlaceholder id="korek_config" location="file:${config.path}/my-config.properties"/>

    <route>

        <from uri="...."/>

        <multicast parallelProcessing="true"
                   strategyRef="balancesAggregator"
                   timeout="{{retrieve.balances.timeout}}">

            <to uri="direct:balancesRead"/>
            <bean ref="serviceBean" method="getBalances"/>
        </multicast>

    </route>    

</camel:camelContext>

Solution

  • For using integer properties this way, check out http://camel.apache.org/using-propertyplaceholder.html in the section "Using property placeholders for any kind of attribute in the XML DSL.". You will need to define a namespace for the properties in your blueprint/spring definition:

    xmlns:prop="http://camel.apache.org/schema/placeholder"
    

    then you should be able to refer to the property with

    <multicast parallelProcessing="true"  prop:timeout="retrieve.balances.timeout">