camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [3/4] camel git commit: Added Message Endpoint docs to Gitbook
Date Tue, 25 Oct 2016 08:02:56 GMT
Added Message Endpoint docs to Gitbook


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/cf51125c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/cf51125c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/cf51125c

Branch: refs/heads/master
Commit: cf51125ca6d886f4474543002492a7649759e501
Parents: 08371c3
Author: Andrea Cosentino <ancosen@gmail.com>
Authored: Tue Oct 25 09:51:18 2016 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Tue Oct 25 09:51:18 2016 +0200

----------------------------------------------------------------------
 camel-core/src/main/docs/message-endpoint.adoc | 192 ++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                 |   1 +
 2 files changed, 193 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/cf51125c/camel-core/src/main/docs/message-endpoint.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/message-endpoint.adoc b/camel-core/src/main/docs/message-endpoint.adoc
new file mode 100644
index 0000000..bb7bd5d
--- /dev/null
+++ b/camel-core/src/main/docs/message-endpoint.adoc
@@ -0,0 +1,192 @@
+[[MessageEndpoint-MessageEndpoint]]
+Message Endpoint
+^^^^^^^^^^^^^^^^
+
+Camel supports the
+http://www.enterpriseintegrationpatterns.com/MessageEndpoint.html[Message
+Endpoint] from the link:enterprise-integration-patterns.html[EIP
+patterns] using the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html[Endpoint]
+interface.
+
+image:http://www.enterpriseintegrationpatterns.com/img/MessageEndpointSolution.gif[image]
+
+When using the link:dsl.html[DSL] to create link:routes.html[Routes] you
+typically refer to Message Endpoints by their link:uris.html[URIs]
+rather than directly using the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Endpoint.html[Endpoint]
+interface. Its then a responsibility of the
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html[CamelContext]
+to create and activate the necessary Endpoint instances using the
+available
+http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Component.html[Component]
+implementations.
+
+[[MessageEndpoint-Example]]
+Example
++++++++
+
+The following example route demonstrates the use of a
+https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=38922[File]
+Consumer Endpoint and link:jms.html[JMS] Producer Endpoint
+
+*Using the link:fluent-builders.html[Fluent Builders]*
+
+[source,java]
+----------------------------------------
+from("file://local/router/messages/foo")
+    .to("jms:queue:foo");
+----------------------------------------
+
+**Using the link:spring-xml-extensions.html[Spring XML Extensions]**
+
+[source,xml]
+--------------------------------------------------
+<route>
+    <from uri="file://local/router/messages/foo"/>
+    <to uri="jms:queue:foo"/>
+</route>
+--------------------------------------------------
+
+ 
+
+[[MessageEndpoint-DynamicTo]]
+Dynamic To
+^^^^^^^^^^
+
+*Available as of Camel 2.16*
+
+There is a new <toD> that allows to send a message to a dynamic
+computed link:endpoint.html[Endpoint] using one or
+more link:expression.html[Expression] that are concat together. By
+default the link:simple.html[Simple] language is used to compute
+the endpoint. For example to send a message to a endpoint defined by a
+header you can do
+
+[source,xml]
+----------------------------
+<route>
+  <from uri="direct:start"/>
+  <toD uri="${header.foo}"/>
+</route>
+----------------------------
+
+And in Java DSL
+
+[source,java]
+------------------------
+from("direct:start")
+  .toD("${header.foo}");
+------------------------
+
+ 
+
+You can also prefix the uri with a value because by default the uri is
+evaluated using the link:simple.html[Simple] language
+
+[source,xml]
+--------------------------------
+<route>
+  <from uri="direct:start"/>
+  <toD uri="mock:${header.foo"/>
+</route>
+--------------------------------
+
+And in Java DSL
+
+[source,java]
+-----------------------------
+from("direct:start")
+  .toD("mock:${header.foo}");
+-----------------------------
+
+In the example above we compute an endpoint that has prefix "mock:" and
+then the header foo is appended. So for example if the header foo has
+value order, then the endpoint is computed as "mock:order".
+
+You can also use other languages than link:simple.html[Simple] such
+as link:xpath.html[XPath] - this requires to prefix with language: as
+shown below (simple language is the default language). If you do not
+specify language: then the endpoint is a component name. And in some
+cases there is both a component and language with the same name such as
+xquery.
+
+[source,xml]
+-----------------------------------------
+<route>
+  <from uri="direct:start"/>
+  <toD uri="language:xpath:/order/@uri"/>
+</route>
+-----------------------------------------
+
+This is done by specifying the name of the language followed by a colon.
+
+[source,java]
+-------------------------------------
+from("direct:start")
+  .toD("language:xpath:/order/@uri");
+-------------------------------------
+
+You can also concat multiple link:language.html[Language](s) together
+using the plus sign `+` such as shown below:
+
+[source,xml]
+-----------------------------------------------------------
+<route>
+  <from uri="direct:start"/>
+  <toD uri="jms:${header.base}+language:xpath:/order/@id"/>
+</route>
+-----------------------------------------------------------
+
+In the example above the uri is a combination
+of link:simple.html[Simple] language and link:xpath.html[XPath] where
+the first part is simple (simple is default language). And then the plus
+sign separate to another language, where we specify the language name
+followed by a colon
+
+[source,java]
+-------------------------------------------------------
+from("direct:start")
+  .toD("jms:${header.base}+language:xpath:/order/@id");
+-------------------------------------------------------
+
+You can concat as many languages as you want, just separate them with
+the plus sign
+
+The Dynamic To has a few options you can configure
+
+[width="100%",cols="10%,10%,80%",options="header",]
+|=======================================================================
+|Name |Default Value |Description
+
+|uri |  | *Mandatory:* The uri to use. See above
+
+|pattern |  | To set a specific link:exchange-pattern.html[Exchange Pattern] to use
+when sending to the endpoint. The original MEP is restored afterwards.
+
+|cacheSize |  | Allows to configure the cache size for the `ProducerCache` which caches
+producers for reuse. Will by default use the default cache size which is
+1000. Setting the value to -1 allows to turn off the cache all together.
+
+|ignoreInvalidEndpoint |`false` |Whether to ignore an endpoint URI that could not be resolved.
If
+disabled, Camel will throw an exception identifying the invalid endpoint
+URI.
+|=======================================================================
+ 
+
+For more details see
+
+* link:recipient-list.html[Recipient List]
+* link:message.html[Message]
+* link:wire-tap.html[Wire Tap] 
+
+[[MessageEndpoint-UsingThisPattern]]
+Using This Pattern
+++++++++++++++++++
+
+If you would like to use this EIP Pattern then please read the
+link:getting-started.html[Getting Started], you may also find the
+link:architecture.html[Architecture] useful particularly the description
+of link:endpoint.html[Endpoint] and link:uris.html[URIs]. Then you could
+try out some of the link:examples.html[Examples] first before trying
+this pattern out.

http://git-wip-us.apache.org/repos/asf/camel/blob/cf51125c/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index ed60548..805df3b 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -80,6 +80,7 @@
     * [Message Channel](message-channel.adoc)
     * [Message Router](message-router.adoc)
     * [Message Translator](message-translator.adoc)
+    * [Message Endpoint](message-endpoint.adoc)
     * [Pipes and Filter](pipes-and-filters.adoc)
     * [Request Reply](request-reply.adoc)
     * [Return Address](return-address.adoc)


Mime
View raw message