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
commit 291314f7283de67d72f6bd8c526e4226b4bf4536 Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jun 10 22:55:56 2026 +0200 Add camel 1 tribute to bundled examples. Fix jbang cli rebrand maven doc updater --- .../ROOT/pages/camel-jbang-configuration.adoc | 2 +- dsl/camel-jbang/camel-jbang-core/pom.xml | 4 + .../resources/examples/camel-1-tribute/README.md | 87 ++++++++++++++++++++++ .../camel-1-tribute/application.properties | 17 +++++ .../camel-1-tribute/jms-to-file.camel.yaml | 35 +++++++++ .../maven/packaging/PrepareCamelJBangDocMojo.java | 2 +- 6 files changed, 145 insertions(+), 2 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang-configuration.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang-configuration.adoc index 430cb5af1493..6ace19aaa0c0 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-jbang-configuration.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-jbang-configuration.adoc @@ -3,7 +3,7 @@ This page covers configuring the Camel CLI — available options, configuration commands, and how to set up your environment. // jbang options: START -== Configuration Options +=== Camel CLI configurations The camel.jbang supports 48 options, which are listed below. [width="100%",cols="2,5,^1,2",options="header"] diff --git a/dsl/camel-jbang/camel-jbang-core/pom.xml b/dsl/camel-jbang/camel-jbang-core/pom.xml index 41282cd5a789..b6fc08ddf075 100644 --- a/dsl/camel-jbang/camel-jbang-core/pom.xml +++ b/dsl/camel-jbang/camel-jbang-core/pom.xml @@ -290,6 +290,10 @@ usetimestamp="true"/> </sequential> </macrodef> + <!-- camel-1-trbute --> + <sync-example name="camel-1-tribute" file="README.md"/> + <sync-example name="camel-1-tribute" file="application.properties"/> + <sync-example name="camel-1-tribute" file="jms-to-file.camel.yaml"/> <!-- circuit-breaker --> <sync-example name="circuit-breaker" file="README.md"/> <sync-example name="circuit-breaker" file="route.camel.yaml"/> diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/README.md b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/README.md new file mode 100644 index 000000000000..f1c50b903d4a --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/README.md @@ -0,0 +1,87 @@ +## Camel 1.0 Tribute - JMS to File + +A tribute to the very first Apache Camel example ever written. + +When Apache Camel 1.0 was released in June 2007, the project shipped with just two examples. +The first and most iconic was `camel-example-jms-file` - a simple route that consumed messages +from a JMS queue and saved them to the file system. + +Back then, Camel was still part of the Apache ActiveMQ project. The README was signed +_"The Apache ActiveMQ team"_, the website lived at `activemq.apache.org/camel`, +and classes like `CamelTemplate` (later renamed to `ProducerTemplate`) were brand new. + +The original example looked like this: + +```java +CamelContext context = new DefaultCamelContext(); + +ConnectionFactory connectionFactory = + new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); +context.addComponent("test-jms", + JmsComponent.jmsComponentAutoAcknowledge(connectionFactory)); + +context.addRoutes(new RouteBuilder() { + public void configure() { + from("test-jms:queue:test.queue").to("file://test"); + } +}); + +CamelTemplate template = new CamelTemplate(context); +context.start(); + +for (int i = 0; i < 10; i++) { + template.sendBody("test-jms:queue:test.queue", "Test Message: " + i); +} +``` + +That was 40+ lines of Java, a Maven project, ActiveMQ embedded in-process, +and manual component wiring. + +Today, the same example is a single YAML file and one command. + +### Running the example + +Start an Apache ActiveMQ Artemis broker: + +```sh +$ camel infra run artemis +``` + +Or with Docker manually: + +```sh +$ docker run --detach --name mycontainer -p 61616:61616 -p 8161:8161 --rm apache/activemq-artemis:latest-alpine +``` + +Then run the example: + +```sh +$ camel run * +``` + +Camel will send 10 test messages to the `test.queue` JMS queue (just like the original) +and consume them back, saving each message as a file in the `test` directory. + +### What changed in 19 years + +| | Camel 1.0 (2007) | Camel CLI (today) | +|---|---|---| +| **Language** | Java (40+ lines) | YAML (25 lines) | +| **Build** | Maven project with pom.xml | No build needed | +| **Broker** | Embedded ActiveMQ (in-process) | Apache ActiveMQ Artemis (container) | +| **Component setup** | Manual `ConnectionFactory` wiring | Auto-configured via properties | +| **Run command** | `mvn camel:run` | `camel run *` | +| **Dependencies** | Declared in pom.xml | Auto-downloaded | + +What stayed the same: `from("jms:queue:test.queue").to("file://test")` - the core routing idea +that made Camel what it is today. + +### Help and contributions + +If you hit any problem using Camel or have some feedback, then please +[let us know](https://camel.apache.org/community/support/). + +We also love contributors, so +[get involved](https://camel.apache.org/community/contributing/) :-) + +The Camel riders! diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/application.properties b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/application.properties new file mode 100644 index 000000000000..79bbe7865c6f --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/application.properties @@ -0,0 +1,17 @@ +# artemis connection factory +camel.beans.artemisCF = #class:org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory +# URL for broker +camel.beans.artemisCF.brokerURL = tcp://localhost:61616 + +# if broker requires specific login +camel.beans.artemisCF.user = artemis +camel.beans.artemisCF.password = artemis + +# pooled connection factory +camel.beans.poolCF = #class:org.messaginghub.pooled.jms.JmsPoolConnectionFactory +camel.beans.poolCF.connectionFactory = #bean:artemisCF +camel.beans.poolCF.maxSessionsPerConnection = 500 +camel.beans.poolCF.connectionIdleTimeout = 20000 + +# setup JMS component to use connection factory +camel.component.jms.connection-factory = #bean:poolCF diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/jms-to-file.camel.yaml b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/jms-to-file.camel.yaml new file mode 100644 index 000000000000..582d02526303 --- /dev/null +++ b/dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/camel-1-tribute/jms-to-file.camel.yaml @@ -0,0 +1,35 @@ +- route: + id: jms-to-file + description: "Camel 1.0 tribute: consume from JMS queue and save to file" + from: + uri: jms + parameters: + destinationName: test.queue + steps: + - log: + message: "Received: ${body}" + - to: + uri: file + parameters: + directoryName: test + +- route: + id: send-test-messages + description: "Send 10 test messages to JMS queue (just like the original example)" + from: + uri: timer + parameters: + timerName: sender + repeatCount: 10 + period: 1000 + steps: + - setBody: + expression: + simple: + expression: "Test Message: ${exchangeProperty.CamelTimerCounter}" + - log: + message: "Sending: ${body}" + - to: + uri: jms + parameters: + destinationName: test.queue diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java index 8f19da01cbd3..5dda587b2e8c 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangDocMojo.java @@ -81,7 +81,7 @@ public class PrepareCamelJBangDocMojo extends AbstractGeneratorMojo { return; } - File file = new File(docDocDir, "camel-jbang.adoc"); + File file = new File(docDocDir, "camel-jbang-configuration.adoc"); boolean exists = file.exists(); boolean updated; try {
