You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2021/11/10 13:32:27 UTC

[camel-examples] branch main updated (43c6dab -> 0c9af51)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git.


    from 43c6dab  CAMEL-16467 - Camel-Examples: Group the example for grouped componets in a middle folder - Azure
     new f89de63  Added A Couchbase Log example
     new 1a7967e  Added Couchbase Log example to POM
     new 0c9af51  Update README

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/README.adoc                               |  4 +++-
 .../kafka-azure => couchbase-log}/README.adoc      | 25 +++++++++++++++-------
 .../aws2-sqs-consumer => couchbase-log}/pom.xml    | 19 ++++++++--------
 .../org/apache/camel/example/MyApplication.java    |  0
 .../org/apache/camel/example/MyRouteBuilder.java   | 10 +++------
 .../src/main/resources/application.properties      | 13 ++++++-----
 .../src/main/resources/logback.xml                 |  0
 examples/pom.xml                                   |  1 +
 8 files changed, 39 insertions(+), 33 deletions(-)
 copy examples/{azure/kafka-azure => couchbase-log}/README.adoc (56%)
 copy examples/{aws/main-endpointdsl-aws2/aws2-sqs-consumer => couchbase-log}/pom.xml (84%)
 copy examples/{main-tiny => couchbase-log}/src/main/java/org/apache/camel/example/MyApplication.java (100%)
 copy examples/{flight-recorder => couchbase-log}/src/main/java/org/apache/camel/example/MyRouteBuilder.java (79%)
 copy examples/{azure/kafka-azure => couchbase-log}/src/main/resources/application.properties (86%)
 copy examples/{routetemplate => couchbase-log}/src/main/resources/logback.xml (100%)

[camel-examples] 01/03: Added A Couchbase Log example

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git

commit f89de6342ca079911a03e86787c8328d341437b0
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 10 14:26:10 2021 +0100

    Added A Couchbase Log example
---
 examples/couchbase-log/README.adoc                 | 46 ++++++++++
 examples/couchbase-log/pom.xml                     | 97 ++++++++++++++++++++++
 .../org/apache/camel/example/MyApplication.java    | 38 +++++++++
 .../org/apache/camel/example/MyRouteBuilder.java   | 30 +++++++
 .../src/main/resources/application.properties      | 27 ++++++
 .../couchbase-log/src/main/resources/logback.xml   | 30 +++++++
 6 files changed, 268 insertions(+)

diff --git a/examples/couchbase-log/README.adoc b/examples/couchbase-log/README.adoc
new file mode 100644
index 0000000..1257e48
--- /dev/null
+++ b/examples/couchbase-log/README.adoc
@@ -0,0 +1,46 @@
+== Camel Main Example Couchbase
+
+This example shows how to use the Camel Main module
+to define a route from Couchbase to Log.
+
+Set your application.properties options correctly.
+You'll need also a running kafka broker.
+
+=== Setting up the Couchbase Container
+
+First of all run the container
+
+[source,sh]
+----
+docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase:6.5.1
+----
+
+Now go to localhost:8091 and create a new cluster with username/password admin/password
+
+Use the sample bucket beer-sample to populate the bucket.
+
+Now you're ready to run the example.
+
+=== How to run
+
+You can run this example using
+
+[source,sh]
+----
+$ mvn compile
+----
+
+[source,sh]
+----
+$ mvn camel:run
+----
+
+=== 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!
diff --git a/examples/couchbase-log/pom.xml b/examples/couchbase-log/pom.xml
new file mode 100644
index 0000000..339858d
--- /dev/null
+++ b/examples/couchbase-log/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+      <groupId>org.apache.camel.example</groupId>
+      <artifactId>examples</artifactId>
+      <version>3.13.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-main-couchbase</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Example :: Main :: Couchbase</name>
+    <description>An example for showing standalone Camel with Couchbase</description>
+
+    <properties>
+        <category>Beginner</category>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <!-- Add Camel BOM -->
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bom</artifactId>
+                <version>${camel.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-main</artifactId>
+        </dependency>
+        <!-- we use these 2 camel components in this example -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-log</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-couchbase</artifactId>
+        </dependency>
+
+        <!-- logging -->
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-core</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>ch.qos.logback</groupId>
+            <artifactId>logback-classic</artifactId>
+            <version>${logback-version}</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <!-- to run the application -->
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-maven-plugin</artifactId>
+                <version>${camel.version}</version>
+                <configuration>
+                    <mainClass>org.apache.camel.example.MyApplication</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
diff --git a/examples/couchbase-log/src/main/java/org/apache/camel/example/MyApplication.java b/examples/couchbase-log/src/main/java/org/apache/camel/example/MyApplication.java
new file mode 100644
index 0000000..496b37d
--- /dev/null
+++ b/examples/couchbase-log/src/main/java/org/apache/camel/example/MyApplication.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+import org.apache.camel.main.Main;
+
+/**
+ * Main class that boot the Camel application
+ */
+public final class MyApplication {
+
+    private MyApplication() {
+    }
+
+    public static void main(String[] args) throws Exception {
+        // use Camels Main class
+        Main main = new Main();
+        // and add the routes (you can specify multiple classes)
+        main.configure().addRoutesBuilder(MyRouteBuilder.class);
+        // now keep the application running until the JVM is terminated (ctrl + c or sigterm)
+        main.run(args);
+    }
+
+}
diff --git a/examples/couchbase-log/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/couchbase-log/src/main/java/org/apache/camel/example/MyRouteBuilder.java
new file mode 100644
index 0000000..91cec4b
--- /dev/null
+++ b/examples/couchbase-log/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyRouteBuilder extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+
+        from("couchbase:http://{{couchbase.host}}:{{couchbase.port}}?bucket={{couchbase.bucket}}&username={{couchbase.username}}&password={{couchbase.password}}&consumerProcessedStrategy={{couchbase.consumerProcessedStrategy}}")
+          .to("log:info");
+
+    }
+}
diff --git a/examples/couchbase-log/src/main/resources/application.properties b/examples/couchbase-log/src/main/resources/application.properties
new file mode 100644
index 0000000..4c061b8
--- /dev/null
+++ b/examples/couchbase-log/src/main/resources/application.properties
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# to configure camel main
+# here you can configure options on camel main (see MainConfigurationProperties class)
+camel.main.name = Kafka-to-Azure-Storage-Blob
+
+couchbase.host=localhost
+couchbase.port=8091
+couchbase.username=admin
+couchbase.password=password
+couchbase.bucket=beer-sample
+couchbase.consumerProcessedStrategy=delete
diff --git a/examples/couchbase-log/src/main/resources/logback.xml b/examples/couchbase-log/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/examples/couchbase-log/src/main/resources/logback.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<configuration>
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+</configuration>

[camel-examples] 03/03: Update README

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git

commit 0c9af513762bbb03e13f1790c158141fe49760e8
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 10 14:31:39 2021 +0100

    Update README
---
 examples/README.adoc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/examples/README.adoc b/examples/README.adoc
index a2262d5..5b304b7 100644
--- a/examples/README.adoc
+++ b/examples/README.adoc
@@ -11,7 +11,7 @@ View the individual example READMEs for details.
 == Examples
 
 // examples: START
-Number of Examples: 95 (0 deprecated)
+Number of Examples: 96 (0 deprecated)
 
 [width="100%",cols="4,2,4",options="header"]
 |===
@@ -39,6 +39,8 @@ Number of Examples: 95 (0 deprecated)
 
 | link:console/README.adoc[Console] (console) | Beginner | An example that reads input from the console
 
+| link:couchbase-log/README.adoc[Couchbase Log] (couchbase-log) | Beginner | An example for showing standalone Camel with Couchbase
+
 | link:csimple/readme.adoc[Csimple] (csimple) | Beginner | Shows using compiled simple language
 
 | link:csimple-joor/readme.adoc[Csimple Joor] (csimple-joor) | Beginner | Shows using compiled simple language with jOOR compiler

[camel-examples] 02/03: Added Couchbase Log example to POM

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-examples.git

commit 1a7967e37c3f785e758865e5c2c577ee2fef3116
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Nov 10 14:26:35 2021 +0100

    Added Couchbase Log example to POM
---
 examples/pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/pom.xml b/examples/pom.xml
index c800a3e..0feb1c0 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -104,6 +104,7 @@
         <module>cdi-test</module>
         <module>cdi-xml</module>
         <module>console</module>
+        <module>couchbase-log</module>
         <module>csimple</module>
         <module>csimple-joor</module>
         <module>cxf</module>