You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2022/10/17 14:14:51 UTC
[camel] branch camel-3.18.x updated: Rework ref component docs sample section (#8561)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.18.x by this push:
new fe1db1f0a68 Rework ref component docs sample section (#8561)
fe1db1f0a68 is described below
commit fe1db1f0a68c6af9eb95e4ea7f94f66e73c33b7b
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[]