This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 8c6f930 CAMEL-14109: Polished docs 8c6f930 is described below commit 8c6f9303e4ddfbbfb5005c146fb1ff427f12592f Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Oct 29 06:01:25 2019 +0100 CAMEL-14109: Polished docs --- .../pages/faq/how-to-use-a-dynamic-uri-in-to.adoc | 47 +++++----------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/faq/how-to-use-a-dynamic-uri-in-to.adoc b/docs/user-manual/modules/ROOT/pages/faq/how-to-use-a-dynamic-uri-in-to.adoc index 5618953..a1927ca 100644 --- a/docs/user-manual/modules/ROOT/pages/faq/how-to-use-a-dynamic-uri-in-to.adoc +++ b/docs/user-manual/modules/ROOT/pages/faq/how-to-use-a-dynamic-uri-in-to.adoc @@ -5,14 +5,6 @@ A dynamic URI is an endpoint URI that varies depending on inflight routing information, such as Exchange properties, message headers, the body, the Camel Context, etc. -[NOTE] -==== -*Dynamic To - out of the box* - -From *Camel 2.16* onwards there is a new `<toD>` which is a dynamic to. -See more details at xref:message-endpoint.adoc[Message Endpoint]. -==== - For example, if you're using a Freemarker producer and the template location is provided inside the current message, you might expect the following code to work, *but it will not*. @@ -32,10 +24,7 @@ This snippet is not valid code. Read on. In this case, you must use an EIP (Enterprise Integration Pattern) that is capable of computing a dynamic URI using an xref:expression.adoc[Expression], such as -the xref:recipientList-eip.adoc[Recipient List] EIP pattern. - -For example, rewriting the snippet above to use the -xref:simple-language.adoc[Simple] expression language: +the xref:toD-eip.adoc[ToD] or xref:recipientList-eip.adoc[Recipient List] EIP pattern. [TIP] ==== @@ -44,37 +33,21 @@ xref:simple-language.adoc[Simple] expression language: This snippet is valid code. ==== +To fix the above problem we can use either toD or recipientList. +Using toD is easier as shown below: + [source,java] ---- -.recipientList(simple("freemarker://templateHome/${body.templateName}.ftl")) +.toD("freemarker://templateHome/${body.templateName}.ftl") ---- -Or you could use any other of Camel xref:languages.adoc[Languages]. - -[NOTE] -==== -Notice that the xref:recipientList-eip.adoc[Recipient List] can send to -multiple -xref:endpoint.adoc[Endpoints] -if the expression returns either a `java.util.List`, array, -`java.util.Iteratable` or a `String`. If the returned value is a -`String` then you can specify multiple endpoints separated by comma. So -if you only want to send to *one* endpoint and use a `String` type, then -beware of the comma. If you need to use a comma, then you can change or -turn off the separator on the xref:recipientList-eip.adoc[Recipient List]. - -For example, to turn it, when using *Camel 2.13* onwards: - +When using recipient list: [source,java] ---- -.recipientList(simple("sql:select firstName, lastName from myTable where user = ${header.user}"), "false") +.recipientList(simple("freemarker://templateHome/${body.templateName}.ftl")) ---- -And for users of *Camel 2.12.x* or older, we use a non existing -delimiter char: -[source,java] ----- -.recipientList(simple("sql:select firstName, lastName from myTable where user = ${header.user}"), "@") ----- -==== + + +