Configuration: JDK8, Camel 2.13, Spring, Spring property placeholder, text
properties file
Background: in order to create a dynamic URI for a route with a spring
property, it’s required that you create an endpoint declaration, then refer
to it:
End point declaration:
<endpoint id="camelMongoURI"
uri="mongodb:myDb?database=${mongo_primary_db_name}&collection=mycollection&operation=insert"/>
Then refer to that in the URI property of your route, to allow it to be
dynamic to the spring prop above:
<to uri="ref:camelMongoURI"/>
The bug: if you use dot notation as the naming convention of a property,
similar to mongo.primary.db.name=test, it fails, camel will return null on
that property
If, however, you use a non-dot-notated name for your property name, camel
picks up the property value, like so: mongo_primary_db_name=test
Dot notation elsewhere in camel works fine, we consider this a bug.
properties file
Background: in order to create a dynamic URI for a route with a spring
property, it’s required that you create an endpoint declaration, then refer
to it:
End point declaration:
<endpoint id="camelMongoURI"
uri="mongodb:myDb?database=${mongo_primary_db_name}&collection=mycollection&operation=insert"/>
Then refer to that in the URI property of your route, to allow it to be
dynamic to the spring prop above:
<to uri="ref:camelMongoURI"/>
The bug: if you use dot notation as the naming convention of a property,
similar to mongo.primary.db.name=test, it fails, camel will return null on
that property
If, however, you use a non-dot-notated name for your property name, camel
picks up the property value, like so: mongo_primary_db_name=test
Dot notation elsewhere in camel works fine, we consider this a bug.