You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2020/03/24 18:43:04 UTC

[camel-quarkus] branch master updated: Documented the use of quarkus.camel.resources.*-patterns #961

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

aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new abb274d  Documented the use of quarkus.camel.resources.*-patterns #961
abb274d is described below

commit abb274d1d3ecd0aa3458c2ee0628d756d78825d2
Author: aldettinger <al...@gmail.com>
AuthorDate: Tue Mar 24 18:26:50 2020 +0100

    Documented the use of quarkus.camel.resources.*-patterns #961
---
 docs/modules/ROOT/pages/extensions/mustache.adoc   | 38 ++++++++++++++++++++++
 .../pages/list-of-camel-quarkus-extensions.adoc    |  2 +-
 docs/modules/ROOT/pages/native-mode.adoc           | 16 ++++++++-
 3 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/docs/modules/ROOT/pages/extensions/mustache.adoc b/docs/modules/ROOT/pages/extensions/mustache.adoc
new file mode 100644
index 0000000..39bd9c9
--- /dev/null
+++ b/docs/modules/ROOT/pages/extensions/mustache.adoc
@@ -0,0 +1,38 @@
+[[mustache]]
+= Mustache Extension
+
+*Since Camel Quarkus 1.0.0-M5*
+
+The mustache extension provides the capability to transform an incoming message using a link:https://mustache.github.io/[Mustache template].
+
+Maven users will need to add the following dependency to their `pom.xml` for this extension.
+
+[source,xml]
+------------------------------------------------------------
+<dependency>
+    <groupId>org.apache.camel.quarkus</groupId>
+    <artifactId>camel-quarkus-mustache</artifactId>
+</dependency>
+------------------------------------------------------------
+
+== Usage
+
+The extension provides support for the Camel https://camel.apache.org/components/latest/mustache-component.html[Mustache Component].
+
+=== Configuration
+
+Beyond standard usages described above, a trick is needed when using mustache templates from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
+
+For instance, the route below would load the mustache template from a classpath resource named _template/simple.mustache_:
+[source,java]
+----
+from("direct:start").to("mustache://template/simple.mustache");
+----
+
+In order to work in native mode the `include-patterns` configuration should be set. For instance, in the `application.properties` file as below :
+[source,properties]
+----
+quarkus.camel.resources.include-patterns = template/*.mustache
+----
+
+More information about selecting resources for inclusion in the native executable could be found at xref:native-mode.adoc#embedding-resource-in-native-executable[Embedding resource in native executable].
\ No newline at end of file
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 25f4013..2fc1ce4 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -417,7 +417,7 @@ Level | Since | Description
 `mongodb-gridfs:connectionBean` | JVM +
  Preview | 1.0.0-M6 | Component for working with MongoDB GridFS.
 
-| link:https://camel.apache.org/components/latest/mustache-component.html[Mustache] (camel-quarkus-mustache) +
+| xref:extensions/mustache.adoc[Mustache] (camel-quarkus-mustache) +
 `mustache:resourceUri` | Native +
  Stable | 1.0.0-M5 | Transforms the message using a Mustache template.
 
diff --git a/docs/modules/ROOT/pages/native-mode.adoc b/docs/modules/ROOT/pages/native-mode.adoc
index f1f8d73..317e0b9 100644
--- a/docs/modules/ROOT/pages/native-mode.adoc
+++ b/docs/modules/ROOT/pages/native-mode.adoc
@@ -5,7 +5,7 @@ Things to consider before you run your application in the native mode.
 [[charsets]]
 == Character encodings
 
-By default only a the following `Charsets` are available in the native mode (https://github.com/oracle/graal/blob/vm-19.3.0/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LocalizationFeature.java#L149-L163[source]):
+By default only the following `Charsets` are available in the native mode (https://github.com/oracle/graal/blob/vm-19.3.0/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/LocalizationFeature.java#L149-L163[source]):
 
 [code,text]
 ----
@@ -23,3 +23,17 @@ quarkus.native.add-all-charsets = true
 
 See also https://quarkus.io/guides/all-config#quarkus-core_quarkus.native.add-all-charsets[quarkus.native.add-all-charsets]
 in Quarkus documentation.
+
+[[embedding-resource-in-native-executable]]
+== Embedding resource in native executable
+
+Resources needed at runtime need to be explicitly embedded in the built native executable. In such situations, the `include-patterns` and `exclude-patterns` configurations could be set in `application.properties` as demonstrated below:
+[code,properties]
+----
+quarkus.camel.resources.include-patterns = docs/*,images/*
+quarkus.camel.resources.exclude-patterns = docs/ignored.adoc,images/ignored.png
+----
+In the example above, resources named _docs/included.adoc_ and _images/included.png_ would be embedded in the native executable while _docs/ignored.adoc_ and _images/ignored.png_ would not.
+
+`include-patterns` and `exclude-patterns` are list of comma separated link:https://github.com/apache/camel/blob/master/core/camel-util/src/main/java/org/apache/camel/util/AntPathMatcher.java[Ant-path style patterns].
+At the end of the day, resources matching `include-patterns` are marked for inclusion at the exception of resources matching `exclude-patterns`.