Search code examples
timeoutapache-camel

dynamic timeout for camel split


I am using camel 2.13.2 and want to set timeout for camel:split that can be read from exchange.

static timeout works well.

<camel:split timeout="500">

but not the following. assume I have set property.timeout as an exchange property

<camel:split timeout="{{property.timeout}}">

I get following error during server startup

Caused by: org.xml.sax.SAXParseException; lineNumber: 75; columnNumber: 67; cvc-datatype-valid.1.2.1: '{{property.timeout}}' is not a valid value for 'integer'.

Is there anyway timeout for split can be set in dynamic way?

Appreciate your help!


Solution

  • Yes you need to specify this using the prop prefix which is documented in the Camel website. See the section Using Property Placeholders for Any Kind of Attribute in the XML DSL at: http://camel.apache.org/using-propertyplaceholder.html

    So that becomes

    <camel:split prop:timeout="{{property.timeout}}">
    

    And you need to remember to add prop in the top of the XML file as a namespace, eg

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

    But see more details in that link.