Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Camel Route: Dynamic Endpoint using PropertyPlaceholder


In this article we will discuss how to use property placeholder for lookup or creating the camel endpoints URIs. This is applicable to all camel component. However, we will only discuss mail(pop3) throughout this article.


  • Define the camel consumer route for monitoring the email arrivals in an inbox.
  • All the endpoint properties like host/username/password ..etc are defined in properties file(, instead hardcoding them.
  • Use these properties in camel route to resolve the endpoints.


  • You don't need to hardcode sensitive information like userName/password ..etc while defining the process
  • Later on if you want to change this route to listen another server/useraccount you don't need to re-define/re-model the processes. And no need to re-deploy the model.
  • What all you need to do is just update the properties and re-start the server.


To implement the use case we will be:

  • Define one process startable by camel email trigger.
  • In email trigger we will use property placeholder syntax.
  • Will define the properties file in default-camel-context.xml

How to do

  • Defining the camel trigger route:

The syntax to use Camel's property placeholder is to use {{key}} for example {{}} where 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.

Below is the route code for the camel trigger:

<from uri="{{}}://{{}}?username={{}}&password={{}}&consumer.delay={{alertmanager.standard.poll.delay}}&consumer.useFixedDelay=true"/> <convertBodyTo type="java.lang.String"/> <to uri="ipp:direct"/>


As mentioned in above route all of the properties will be resolved from the properties file.

  • Defining the properites:

We will use file to read/define the properties for camel endpoints. Add all properties which we used in above route.


  • Configure camel to use this file for properties placeholder:

In default-camel-context.xml define below bean:

<bean id="properties" class="">
    <property name="location" value=""/>


Final process will look something similar to below:


Once you will deploy this model from Adminstration-->integration-management:



Process model discussed in this article can be downloaded from here

Back to the top