This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Using PropertyPlaceholder

Versions Compared

Key

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

...

The syntax to use Camel's property placeholder is to use # {{key}} for example # {{file.uri}} where file.uri is the property key.
You can use property placeholders in parts of the endpoint URI's which for example you can use placeholders for parameters in the URIs.

...

Code Block
// properties
cool.end=mock:result

// route
from("direct:start").to("properties:#{{cool.end}}");

You can also use placeholders as a part of the endpoint uri:

Code Block
// properties
cool.foo=result

// route
from("direct:start").to("properties:mock:#{{cool.foo}}");

In the example above the to endpoint will be resolved to mock:result.

...

Code Block
// properties
cool.foo=result
cool.concat=mock:#{cool.foo}

// route
from("direct:start").to("properties:mock:#{{cool.concat}}");

Notice how cool.concat refer to another property.

...

Code Block
   from("direct:start").to("properties:#{bar.end}?locations=com/mycompany/bar.properties");

...

Code Block
// properties
cool.foo=result

// route
from("direct:start").to("mock:#{{cool.foo}}");

And you can use them in multiple wherever you want them:

Code Block
// properties
cool.start=direct:start
cool.showid=true
cool.result=result

// route
from("#{{cool.start}}")
    .to("log:#{{cool.start}}?showBodyType=false&showExchangeId=#{{cool.showid}}")
    .to("mock:#{{cool.result}}");

You can also your property placeholders when using ProducerTemplate for example:

Code Block
template.sendBody("#{{cool.start}}", "Hello World");

Example with Simple language

...