skip to Main Content

I have a processor with below code

ProducerTemplate.sendBodyAndProperty("direct:endpoint", body, property, propertyValue) 

I need to use propertyValue in the below route()

<route>
    <from uri="direct:endpoint" />
    <to uri="file:/?fileName=${propertyValue}" />
</route>

Please advice

2

Answers


  1. Chosen as BEST ANSWER

    After making below change it worked like charm..thank you @M.Ricciuti

    .to("file:?fileName=$simple{exchangeProperty.targetFileName}") 
    

  2. With the producer method sendBodyAndProperty you are setting an exchange property : so you can simply use Exchange Property EL in your route definition.

    Assuming your property key is “targetFileName”, you can write:

    <route>
        <from uri="direct:endpoint" />
        <to uri="file:/?fileName=${exchangeProperty.targetFileName}" />
    </route>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search