You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2016/06/14 14:55:20 UTC

[3/3] camel git commit: Added ref components docs to Gitbook

Added ref components 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/e9368518
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e9368518
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e9368518

Branch: refs/heads/master
Commit: e9368518a77d100f8d0f65035b286544322bc868
Parents: 5a6d2f6
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Jun 14 16:54:23 2016 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Jun 14 16:54:23 2016 +0200

----------------------------------------------------------------------
 camel-core/src/main/docs/ref.adoc | 108 +++++++++++++++++++++++++++++++++
 docs/user-manual/en/SUMMARY.md    |   1 +
 2 files changed, 109 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e9368518/camel-core/src/main/docs/ref.adoc
----------------------------------------------------------------------
diff --git a/camel-core/src/main/docs/ref.adoc b/camel-core/src/main/docs/ref.adoc
new file mode 100644
index 0000000..a73eb40
--- /dev/null
+++ b/camel-core/src/main/docs/ref.adoc
@@ -0,0 +1,108 @@
+[[Ref-RefComponent]]
+Ref Component
+~~~~~~~~~~~~~
+
+The *ref:* component is used for lookup of existing endpoints bound in
+the link:registry.html[Registry].
+
+[[Ref-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source,java]
+----------------------
+ref:someName[?options]
+----------------------
+
+Where *someName* is the name of an endpoint in the
+link:registry.html[Registry] (usually, but not always, the Spring
+registry). If you are using the Spring registry, `someName` would be the
+bean ID of an endpoint in the Spring registry.
+
+[[Ref-Options]]
+Ref Options
+^^^^^^^^^^^
+
+
+// component options: START
+The Ref component has no options.
+// component options: END
+
+
+
+// endpoint options: START
+The Ref component supports 5 endpoint options which are listed below:
+
+{% raw %}
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| name | common |  | String | *Required* Name of endpoint to lookup in the registry.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange.
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+{% endraw %}
+// endpoint options: END
+
+
+[[Ref-Runtimelookup]]
+Runtime lookup
+^^^^^^^^^^^^^^
+
+This component can be used when you need dynamic discovery of endpoints
+in the link:registry.html[Registry] where you can compute the URI at
+runtime. Then you can look up the endpoint using the following code:
+
+[source,java]
+-------------------------------------------------------------------
+   // lookup the endpoint
+   String myEndpointRef = "bigspenderOrder";
+   Endpoint endpoint = context.getEndpoint("ref:" + myEndpointRef);
+   
+   Producer producer = endpoint.createProducer();
+   Exchange exchange = producer.createExchange();
+   exchange.getIn().setBody(payloadToSend);
+   // send the exchange
+   producer.process(exchange);
+   ...
+-------------------------------------------------------------------
+
+And you could have a list of endpoints defined in the
+link:registry.html[Registry] such as:
+
+[source,xml]
+----------------------------------------------------------------------------------
+  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+      <endpoint id="normalOrder" uri="activemq:order.slow"/>
+      <endpoint id="bigspenderOrder" uri="activemq:order.high"/>
+      ...
+  </camelContext>
+----------------------------------------------------------------------------------
+
+[[Ref-Sample]]
+Sample
+^^^^^^
+
+In the sample below we use the `ref:` in the URI to reference the
+endpoint with the spring ID, `endpoint2`:
+
+You could, of course, have used the `ref` attribute instead:
+
+[source,xml]
+---------------------------
+      <to ref="endpoint2"/>
+---------------------------
+
+Which is the more common way to write it.
+
+[[Ref-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]
+

http://git-wip-us.apache.org/repos/asf/camel/blob/e9368518/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index b0afd23..e1e769e 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -88,6 +88,7 @@
     * [Log](log.adoc)
     * [Mock](mock.adoc)
     * [Properties](properties.adoc)
+    * [Ref](ref.adoc)
 
 * Components
     * [Async Http Client (AHC)](ahc.adoc)