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 2024/03/21 15:06:00 UTC

(camel-kamelets-examples) branch main updated: Add camel v1 example

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-kamelets-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new ddb7feb  Add camel v1 example
ddb7feb is described below

commit ddb7feb2d37e84923e52e3dab698587c97692cd8
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 21 16:05:41 2024 +0100

    Add camel v1 example
---
 jbang/camel-1.0/MyRouteBuilder.java | 40 ++++++++++++++++++++++
 jbang/camel-1.0/README.adoc         | 66 +++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+)

diff --git a/jbang/camel-1.0/MyRouteBuilder.java b/jbang/camel-1.0/MyRouteBuilder.java
new file mode 100644
index 0000000..c62f79a
--- /dev/null
+++ b/jbang/camel-1.0/MyRouteBuilder.java
@@ -0,0 +1,40 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.example.spring;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * A simple example router from an ActiveMQ queue to a file system
+ *
+ * @version $Revision: 1.1 $
+ */
+public class MyRouteBuilder extends RouteBuilder {
+    public void configure() {
+        from("activemq:test.MyQueue").to("file://test");
+
+        // set up a listener on the file component
+        from("file://test").process(new Processor() {
+            public void process(Exchange e) {
+                System.out.println("Received exchange: " + e.getIn());
+            }
+        });
+    }
+}
diff --git a/jbang/camel-1.0/README.adoc b/jbang/camel-1.0/README.adoc
new file mode 100644
index 0000000..6bede73
--- /dev/null
+++ b/jbang/camel-1.0/README.adoc
@@ -0,0 +1,66 @@
+== Camel 1.0
+
+This example is to celebrate the awesome Apache Camel project, by showing
+how you can run an example from the Camel 1.0 release (from 2007).
+
+The example is coded in java and provided unchanged in the `MyRouteBuilder.java` source file.
+The route uses the file and activemq component.
+
+=== Install JBang
+
+First install JBang according to https://www.jbang.dev
+
+When JBang is installed then you should be able to run from a shell:
+
+[source,sh]
+----
+$ jbang --version
+----
+
+This will output the version of JBang.
+
+To run this example you can either install Camel on JBang via:
+
+[source,sh]
+----
+$ jbang app install camel@apache/camel
+----
+
+Which allows to run CamelJBang with `camel` as shown below.
+
+=== How to run
+
+Then you can run this example (with ActiveMQ broker embeded) using:
+
+[source,sh]
+----
+$ camel run MyRouteBuilder.java --prop=camel.component.activemq.embedded=true
+----
+
+Or you can run this with an existing running ActiveMQ broker that connects to port 61616.
+For example to run the broker via Docker:
+
+[source,sh]
+----
+$ docker run -p 61616:61616 -p 8161:8161 apache/activemq-classic
+----
+
+And then run Camel:
+
+[source,sh]
+----
+$ camel run MyRouteBuilder.java
+----
+
+You can then access the ActiveMQ web console http://localhost:8161
+
+
+=== Help and contributions
+
+If you hit any problem using Camel or have some feedback, then please
+https://camel.apache.org/community/support/[let us know].
+
+We also love contributors, so
+https://camel.apache.org/community/contributing/[get involved] :-)
+
+The Camel riders!