user881703
user881703

Reputation: 1199

Camel .contains() not search values from properties file

I need to search string inside the files, I have used below java code search string that working as i expected,

.when(body().convertToString().contains("mytext"))

if i need to change the search string i have to recomple code again, So i try to load search string from the properties file as below I defined findme='mytext' inside the property file but that will not search string with "properties:{{findme}}"

.when(body().convertToString().contains("properties:{{findme}}"))

Upvotes: 0

Views: 1125

Answers (2)

anon
anon

Reputation:

I don't think the contains will do the expected simple expression. You should be explicit about the contains value.

when(body().convertToString().contains(exchangeProperty("findme")))

Upvotes: 0

Mickael
Mickael

Reputation: 4558

I think it should be :

.when(body().convertToString().contains("{{findme}}"))

From Apache Camel documentation on properties :

Syntax

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.

Upvotes: 1

Related Questions