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 eabd32915f10 CAMEL-16861: Update docs
eabd32915f10 is described below
commit eabd32915f10d4bc727a0fdbbd49950c884e18dd
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Feb 16 09:40:25 2026 +0100
CAMEL-16861: Update docs
---
.../main/docs/modules/eips/pages/normalizer.adoc | 25 +++++
.../main/docs/modules/eips/pages/pipeline-eip.adoc | 60 +++-------
.../modules/eips/pages/point-to-point-channel.adoc | 18 +++
.../src/main/docs/modules/eips/pages/poll-eip.adoc | 121 +++++++++++++++++----
.../docs/modules/eips/pages/pollEnrich-eip.adoc | 121 +++++++++++++++++----
.../main/docs/modules/eips/pages/process-eip.adoc | 14 ++-
.../eips/pages/publish-subscribe-channel.adoc | 32 +++++-
7 files changed, 300 insertions(+), 91 deletions(-)
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc
index 26742f626882..b88777161262 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/normalizer.adoc
@@ -59,6 +59,31 @@ XML::
<bean id="normalizer" class="org.apache.camel.processor.MyNormalizer"/>
----
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - choice:
+ when:
+ - expression:
+ xpath:
+ expression: /employee
+ steps:
+ - to:
+ uri: bean:normalizer?method=employeeToPerson
+ - expression:
+ xpath:
+ expression: /customer
+ steps:
+ - to:
+ uri: bean:normalizer?method=customerToPerson
+ - to:
+ uri: mock:result
+----
====
In this case, we're using a Java xref:ROOT:bean-component.adoc[Bean] as the
normalizer.
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/pipeline-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/pipeline-eip.adoc
index a1a3a3036f00..d51531c8aa6e 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/pipeline-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/pipeline-eip.adoc
@@ -66,24 +66,16 @@ YAML::
----
- route:
from:
- uri: activemq
- parameters:
- destinationName: cheese
+ uri: activemq:cheese
steps:
- pipeline:
steps:
- to:
- uri: bean
- parameters:
- beanName: foo
+ uri: bean:foo
- to:
- uri: bean
- parameters:
- beanName: bar
+ uri: bean:bar
- to:
- uri: activemq
- parameters:
- destinationName: wine
+ uri: activemq:wine
----
====
@@ -120,22 +112,14 @@ YAML::
----
- route:
from:
- uri: activemq
- parameters:
- destinationName: cheese
+ uri: activemq:SomeQueue
steps:
- to:
- uri: bean
- parameters:
- beanName: foo
+ uri: bean:foo
- to:
- uri: bean
- parameters:
- beanName: bar
+ uri: bean:bar
- to:
- uri: activemq
- parameters:
- destinationName: wine
+ uri: activemq:OutputQueue
----
====
@@ -206,39 +190,25 @@ YAML::
----
- route:
from:
- uri: activemq
- parameters:
- destinationName: SomeQueue
+ uri: activemq:SomeQueue
steps:
- multicast:
steps:
- pipeline:
steps:
- to:
- uri: bean
- parameters:
- beanName: something
+ uri: bean:something
- to:
- uri: log
- parameters:
- loggerName: Something
+ uri: log:something
- pipeline:
steps:
- to:
- uri: bean
- parameters:
- beanName: foo
+ uri: bean:foo
- to:
- uri: bean
- parameters:
- beanName: bar
+ uri: bean:bar
- to:
- uri: activemq
- parameters:
- destinationName: OutputQueue
+ uri: activemq:OutputQueue
- to:
- uri: log
- parameters:
- loggerName: result
+ uri: log:result
----
====
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/point-to-point-channel.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/point-to-point-channel.adoc
index 75f1b378f7b4..010fb0d26b3d 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/point-to-point-channel.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/point-to-point-channel.adoc
@@ -57,4 +57,22 @@ XML::
</route>
</routes>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - to:
+ uri: jms:queue:foo
+- route:
+ from:
+ uri: jms:queue:foo
+ steps:
+ - to:
+ uri: bean:foo
+----
====
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc
index b83a1ff76f80..82da39128a1f 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc
@@ -66,48 +66,127 @@ The timeout values are in milliseconds.
For example to download an FTP file:
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:payload")
+ .poll("ftp:myserver.com/myfolder?fileName=report-file.pdf");
+----
+
+XML::
++
[source,xml]
----
-<rest path="/report">
- <description>Report REST API</description>
- <get path="/{id}/payload">
- <route id="report-payload-download">
- <poll uri="ftp:myserver.com/myfolder?fileName=report-file.pdf"/>
- </route>
- </get>
-</rest>
+<route>
+ <from uri="direct:payload"/>
+ <poll uri="ftp:myserver.com/myfolder?fileName=report-file.pdf"/>
+</route>
----
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:payload
+ steps:
+ - poll:
+ uri: ftp:myserver.com/myfolder?fileName=report-file.pdf
+----
+====
+
NOTE: You can use dynamic values using the simple language in the uri, as
shown below:
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:payload")
+ .poll("ftp:myserver.com/myfolder?fileName=report-${header.id}.pdf");
+----
+
+XML::
++
[source,xml]
----
-<rest path="/report">
- <description>Report REST API</description>
- <get path="/{id}/payload">
- <route id="report-payload-download">
- <poll
uri="ftp:myserver.com/myfolder?fileName=report-${header.id}.pdf"/>
- </route>
- </get>
-</rest>
+<route>
+ <from uri="direct:payload"/>
+ <poll uri="ftp:myserver.com/myfolder?fileName=report-${header.id}.pdf"/>
+</route>
----
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:payload
+ steps:
+ - poll:
+ uri: "ftp:myserver.com/myfolder?fileName=report-${header.id}.pdf"
+----
+====
+
=== Using Poll with Rest DSL
You can also use `poll` with xref:manual::rest-dsl.adoc[Rest DSL] to,
for example, download a file from xref:ROOT:aws2-s3-component.adoc[AWS S3] as
the response of an API call.
+[tabs]
+====
+Java::
++
+[source,java]
+----
+rest("/report")
+ .get("/{id}/payload")
+ .to*("direct:payload");
+
+from("direct:payload")
+
.poll("aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf")
+----
+
+XML::
++
[source,xml]
----
-<rest path="/report">
- <description>Report REST API</description>
+<rest path="/report" desription="Report REST API">
<get path="/{id}/payload">
- <route id="report-payload-download">
- <poll
uri="aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf"/>
- </route>
+ <to uri="direct:payload"/>
</get>
</rest>
+
+<route>
+ <from uri="direct:payload"/>
+ <poll
uri="aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- rest:
+ path: /report
+ get:
+ - path: /{id}/payload
+ to:
+ uri: direct:payload
+- route:
+ from:
+ uri: direct:payload
+ steps:
+ - poll:
+ uri:
aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf
----
+====
=== Using Poll with file based components
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
index b7e5a9c4566d..0af5a7c44d44 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc
@@ -103,8 +103,15 @@ public class ExampleAggregationStrategy implements
AggregationStrategy {
}
----
-You then use the `AggregationStrategy` with the `pollEnrich` in the Java DSL
as shown:
+You then use the `AggregationStrategy` with the `pollEnrich` in the following
example,
+where Camel will poll a file (timeout 10 seconds). The `AggregationStrategy`
is then used to merge the file with the existing `Exchange`.
+
+[tabs]
+====
+
+Java::
++
[source,java]
----
AggregationStrategy aggregationStrategy = ...
@@ -114,45 +121,99 @@ from("direct:start")
.to("mock:result");
----
-In the example, Camel will poll a file (timeout 10 seconds).
-The `AggregationStrategy` is then used to merge the file with the existing
`Exchange`.
-
-In XML DSL you use `pollEnrich` as follows:
-
+XML::
++
[source,xml]
----
<bean id="myStrategy" class="com.foo.ExampleAggregationStrategy"/>
-<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <route>
- <from uri="direct:start"/>
- <pollEnrich timeout="10000" aggregationStrategy="myStrategy">
- <constant>file:inbox?fileName=data.txt</constant>
- </pollEnrich>
- <to uri="mock:result"/>
- </route>
-</camelContext>
+<route>
+ <from uri="direct:start"/>
+ <pollEnrich timeout="10000" aggregationStrategy="myStrategy">
+ <constant>file:inbox?fileName=data.txt</constant>
+ </pollEnrich>
+ <to uri="mock:result"/>
+</route>
----
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - pollEnrich:
+ aggregationStrategy: myStrategy
+ timeout: 10000
+ expression:
+ constant:
+ expression: file:inbox?fileName=data.txt
+ - to:
+ uri: mock:result
+----
+====
+
+
=== Using Poll Enrich with Rest DSL
You can also use `pollEnrich` with xref:manual::rest-dsl.adoc[Rest DSL] to,
for example, download a file from xref:ROOT:aws2-s3-component.adoc[AWS S3] as
the response of an API call.
+[tabs]
+====
+
+Java::
++
+[source,java]
+----
+rest("/report")
+ .get("/{id}/report")
+ .to("direct:report");
+
+from("direct:report")
+
.pollEnrich("aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf");
+----
+
+XML::
++
[source,xml]
----
<rest path="/report">
- <description>Report REST API</description>
- <get path="/{id}/payload">
- <route id="report-payload-download">
- <pollEnrich>
-
<constant>aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf</constant>
- </pollEnrich>
- </route>
+ <get path="/{id}/report">
+ <to uri="direct:report"/>
</get>
</rest>
+
+<route>
+ <from uri="direct:report"/>
+ <pollEnrich>
+
<constant>aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf</constant>
+ </pollEnrich>
+</route>
----
+YAML::
++
+[source,yaml]
+----
+- rest:
+ path: /report
+ get:
+ - path: /{id}/report
+ to:
+ uri: direct:report
+
+- route:
+ from:
+ uri: direct:report
+ steps:
+ - pollEnrich:
+ uri:
aws-s3:xavier-dev?amazonS3Client=#s3client&deleteAfterRead=false&fileName=report-file.pdf
+----
+====
+
Notice that the enriched endpoint is a constant, however, Camel also supports
dynamic endpoints which is covered next.
=== Poll Enrich with Dynamic Endpoints
@@ -184,6 +245,22 @@ XML::
<to uri="direct:result"/>
</route>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - pollEnrich:
+ expression:
+ simple:
+ expression: "seda:${header.queueName}"
+ - to:
+ uri: direct:result
+----
====
TIP: See the `cacheSize` option for more details on _how much cache_ to use
depending on how many or few unique endpoints are used.
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/process-eip.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/process-eip.adoc
index e0aed468a112..4fc9b38930c0 100644
--- a/core/camel-core-engine/src/main/docs/modules/eips/pages/process-eip.adoc
+++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/process-eip.adoc
@@ -117,6 +117,18 @@ Or if you use Spring XML you can create the processor via
`<bean>`:
</beans>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: activemq:myQueue
+ steps:
+ - process:
+ ref: "#class:com.foo.MyProcessor"
+----
====
=== Why use `process` when you can use `to` instead?
@@ -136,4 +148,4 @@ The process can be used in routes as an anonymous inner
class such:
This is usable for quickly whirling up some code. If the code in the
inner class gets a bit more complicated, it is advised to
-refactor it into a separate class.
+refactor into a separate class.
diff --git
a/core/camel-core-engine/src/main/docs/modules/eips/pages/publish-subscribe-channel.adoc
b/core/camel-core-engine/src/main/docs/modules/eips/pages/publish-subscribe-channel.adoc
index 074a1c9e5619..4b1d5a4b218d 100644
---
a/core/camel-core-engine/src/main/docs/modules/eips/pages/publish-subscribe-channel.adoc
+++
b/core/camel-core-engine/src/main/docs/modules/eips/pages/publish-subscribe-channel.adoc
@@ -50,12 +50,40 @@ XML::
<routes>
<route>
<from uri="direct:start"/>
- <to uri="jms:queue:foo"/>
+ <to uri="jms:topic:cheese"/>
</route>
<route>
- <from uri="jms:queue:foo"/>
+ <from uri="jms:topic:cheese"/>
<to uri="bean:foo"/>
</route>
+ <route>
+ <from uri="jms:topic:cheese"/>
+ <to uri="bean:bar"/>
+ </route>
</routes>
----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+ from:
+ uri: direct:start
+ steps:
+ - to:
+ uri: jms:topic:cheese
+- route:
+ from:
+ uri: jms:topic:cheese
+ steps:
+ - to:
+ uri: bean:foo
+- route:
+ from:
+ uri: jms:topic:cheese
+ steps:
+ - to:
+ uri: bean:bar
+----
====