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 2022/10/17 13:57:58 UTC

[camel] branch main updated: Rework ref component docs sample section (#8561)

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


The following commit(s) were added to refs/heads/main by this push:
     new c9edcaf03d7 Rework ref component docs sample section (#8561)
c9edcaf03d7 is described below

commit c9edcaf03d72c1a15d2d8911b195558d62498b30
Author: James Netherton <ja...@users.noreply.github.com>
AuthorDate: Mon Oct 17 14:57:51 2022 +0100

    Rework ref component docs sample section (#8561)
---
 .../camel-ref/src/main/docs/ref-component.adoc     | 28 ++++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/components/camel-ref/src/main/docs/ref-component.adoc b/components/camel-ref/src/main/docs/ref-component.adoc
index 5ebed1dd89d..ebdb011bb3a 100644
--- a/components/camel-ref/src/main/docs/ref-component.adoc
+++ b/components/camel-ref/src/main/docs/ref-component.adoc
@@ -61,10 +61,10 @@ exchange.getIn().setBody(payloadToSend);
 producer.process(exchange);
 ----
 
-And you could have a list of endpoints defined in the
+With Spring XML, you could have a list of endpoints defined in the
 Registry such as:
 
-[source,xml]
+[source,java]
 ----
 <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
     <endpoint id="normalOrder" uri="activemq:order.slow"/>
@@ -74,17 +74,25 @@ Registry such as:
 
 == 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]
+Bind endpoints to the Camel registry:
+[source,java]
 ----
-<to uri="ref:endpoint2"/>
+context.getRegistry().bind("endpoint1", context.getEndpoint("direct:start"));
+context.getRegistry().bind("endpoint2", context.getEndpoint("log:end"));
 ----
 
-Which is the more common way to write it.
+Use the `ref` URI scheme to refer to endpoints bond to the Camel registry:
+[source,java]
+----
+public class MyRefRoutes extends RouteBuilder {
+    @Override
+    public void configure() {
+        // direct:start -> log:end
+        from("ref:endpoint1")
+            .to("ref:endpoint2");
+    }
+}
+----
 
 
 include::spring-boot:partial$starter.adoc[]