You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/08/18 15:28:45 UTC

[camel] 02/04: Polish and cleanup documentation

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 177c25f36b9d5f3eeb8f324e19ccdc29431be3db
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 18 14:06:48 2021 +0200

    Polish and cleanup documentation
---
 .../ROOT/pages/using-propertyplaceholder.adoc      | 39 +++++++++++++---------
 1 file changed, 24 insertions(+), 15 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/using-propertyplaceholder.adoc b/docs/user-manual/modules/ROOT/pages/using-propertyplaceholder.adoc
index 5ddff63..9957100 100644
--- a/docs/user-manual/modules/ROOT/pages/using-propertyplaceholder.adoc
+++ b/docs/user-manual/modules/ROOT/pages/using-propertyplaceholder.adoc
@@ -229,6 +229,8 @@ xref:producertemplate.adoc[ProducerTemplate] for example:
 template.sendBody("{{cool.start}}", "Hello World");
 ----
 
+=== Using property placeholders with consumer template
+
 This can also be done when using xref:consumertemplate.adoc[ConsumerTemplate], such as:
 
 [source,java]
@@ -236,36 +238,43 @@ This can also be done when using xref:consumertemplate.adoc[ConsumerTemplate], s
 Object body = template.receiveBody("{{cool.start}}");
 ----
 
-
-
-[[UsingPropertyPlaceholder-Examplewithlanguage]]
-== Example with xref:components:languages:simple-language.adoc[Simple] language
+== Using property placeholders with simple language
 
 The xref:components:languages:simple-language.adoc[Simple] language now also support using property
 placeholders, for example in the route below:
 
+[source,properties]
+----
+cheese.quote = Camel rocks
+----
+
+And in the route you can use the placeholder with the usual syntax `{{key}}` as shown:
 
 [source,java]
 ----
-// properties
-cheese.quote=Camel rocks
+from("direct:start")
+  .transform().simple("Hi ${body} do you think {{cheese.quote}}?");
+----
 
-// route from("direct:start")
-    .transform().simple("Hi ${body} do you think ${properties:cheese.quote}?");
+What happens is that Camel will resolve the placeholder during initialization of the route,
+so the route becomes:
+
+[source,java]
+----
+from("direct:start")
+  .transform().simple("Hi ${body} do you think Camel rocks?");
 ----
 
-You can also specify the location in the xref:components:languages:simple-language.adoc[Simple]
-language for example:
+So the simple language would not have any property placeholders anymore.
+This is the most common way.
 
+However, if the placeholder must be resolved by simple language itself,
+then you can use its `${properties}` function:
 
 [source,java]
 ----
-// bar.properties
-bar.quote=Beer tastes good
-
-// route
 from("direct:start")
-    .transform().simple("Hi ${body}. ${properties:com/mycompany/bar.properties:bar.quote}.");
+  .transform().simple("Hi ${body} do you think ${properties:cheese.quote}?");
 ----