I am new to Camel and using simple expression to get value from property file in Java DSL.
.setProperty("PortalUrl", simple("properties:Portal.url"))
Property file value -
Portal.url=abc.com/example
However now i need to get the customer specific URL from property file. Example values -
Portal.url.customer1=abc.com/example/abcd
Portal.url.customer2=abc.com/example/xyz
The customer name comes in the request itself, so i want to do it like
.setProperty("PortalUrl", simple("properties:Portal.url."+"${body.customerName}"))
but the above code is not working its giving me the value of the PortalUrl property as properties:Portal.ulr.customer1
and when i tried with a direct hard-coded value its giving me the right URL from property file -
.setProperty("PortalUrl", simple("properties:Portal.url."+"customer1"))
and it returned correct value - abc.com/example/abcd
But i want to get the URL dynamically as par the customer name in incoming request. Can anyone help me on this, and explain how simple works.
Have you tried with the ${body} function in the simple language:
 .setProperty("PortalUrl", 
     simple("${properties:Portal.url.${body.customerName}}"))
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With