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/04/16 05:55:33 UTC

[camel-examples] branch master updated (96127ef -> a7de550)

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

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


    from 96127ef  Camel-AWS Example: Aws2-s3 should use useDefaultCredentialProvider option, notes
     new 5892c83  Added Azure Eventhubs example
     new 2676b1c  Added Azure Eventhubs example to module
     new 93cb89e  Camel-Azure-Eventhubs: Changed the event message
     new a7de550  Regen

The 4 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 +++-
 examples/{main-endpointdsl => azure-eventhubs}/README.adoc  | 13 ++++---------
 examples/{main-endpointdsl => azure-eventhubs}/pom.xml      | 10 +++++-----
 .../main/java/org/apache/camel/example/MyApplication.java   |  0
 .../main/java/org/apache/camel/example/MyRouteBuilder.java  | 11 +++++++++--
 .../src/main/resources/application.properties               | 13 ++++++++-----
 .../src/main/resources/logback.xml                          |  0
 examples/pom.xml                                            |  1 +
 8 files changed, 30 insertions(+), 22 deletions(-)
 copy examples/{main-endpointdsl => azure-eventhubs}/README.adoc (76%)
 copy examples/{main-endpointdsl => azure-eventhubs}/pom.xml (92%)
 copy examples/{main-tiny => azure-eventhubs}/src/main/java/org/apache/camel/example/MyApplication.java (100%)
 copy examples/{aws/main-endpointdsl-aws2-s3 => azure-eventhubs}/src/main/java/org/apache/camel/example/MyRouteBuilder.java (63%)
 copy examples/{aws/main-endpointdsl-aws2-s3-kafka => azure-eventhubs}/src/main/resources/application.properties (88%)
 copy examples/{routetemplate => azure-eventhubs}/src/main/resources/logback.xml (100%)

[camel-examples] 01/04: Added Azure Eventhubs example

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

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

commit 5892c8382e428852f9c4c7cd92d9fadd2fcda612
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 16 07:50:11 2021 +0200

    Added Azure Eventhubs example
---
 examples/azure-eventhubs/README.adoc               |  30 ++++++
 examples/azure-eventhubs/pom.xml                   | 102 +++++++++++++++++++++
 .../org/apache/camel/example/MyApplication.java    |  38 ++++++++
 .../org/apache/camel/example/MyRouteBuilder.java   |  39 ++++++++
 .../src/main/resources/application.properties      |  29 ++++++
 .../azure-eventhubs/src/main/resources/logback.xml |  30 ++++++
 6 files changed, 268 insertions(+)

diff --git a/examples/azure-eventhubs/README.adoc b/examples/azure-eventhubs/README.adoc
new file mode 100644
index 0000000..a144668
--- /dev/null
+++ b/examples/azure-eventhubs/README.adoc
@@ -0,0 +1,30 @@
+== Camel Example Main Endpoint DSL with Azure Eventhubs
+
+This example shows how to use the endpoint DSL in your Camel routes
+to define endpoints using type safe fluent builders, which are Java methods
+that are compiled.
+
+The example will poll an Azure Eventhub
+
+Notice how you can configure Camel in the `application.properties` file.
+
+Don't forget to correctly set the credentials options in the application properties file
+
+=== How to run
+
+You can run this example using
+
+[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/support.html[let us know].
+
+We also love contributors, so
+https://camel.apache.org/contributing.html[get involved] :-)
+
+The Camel riders!
diff --git a/examples/azure-eventhubs/pom.xml b/examples/azure-eventhubs/pom.xml
new file mode 100644
index 0000000..b1902a2
--- /dev/null
+++ b/examples/azure-eventhubs/pom.xml
@@ -0,0 +1,102 @@
+<?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.10.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-example-azure-eventhubs</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Example :: Azure Eventhubs</name>
+    <description>Azure Eventhubs example</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 the endpoint-dsl -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-endpointdsl</artifactId>
+        </dependency>
+        <!-- we use these 2 camel components in this example -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-timer</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-azure-eventhubs</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/azure-eventhubs/src/main/java/org/apache/camel/example/MyApplication.java b/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyApplication.java
new file mode 100644
index 0000000..496b37d
--- /dev/null
+++ b/examples/azure-eventhubs/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/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java
new file mode 100644
index 0000000..bbab81a
--- /dev/null
+++ b/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -0,0 +1,39 @@
+/*
+ * 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.endpoint.EndpointRouteBuilder;
+import org.apache.camel.component.azure.eventhubs.EventHubsConstants;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * To use the endpoint DSL then we must extend EndpointRouteBuilder instead of RouteBuilder
+ */
+public class MyRouteBuilder extends EndpointRouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+
+        from(azureEventhubs("{{namespaceName}}/{{eventhubName}}").sharedAccessKey("{{sharedAccessKey}}").sharedAccessName("{{sharedAccessName}}").blobAccessKey("{{blobAccessKey}}").blobAccountName("{{blobAccountName}}").blobContainerName("{{blobContainerName}}"))
+                .log("The content is ${body}");
+
+        from(timer("tick").period(1000)).setBody(constant("ciao"))
+                .to(azureEventhubs("{{namespaceName}}/{{eventhubName}}").sharedAccessName("{{sharedAccessName}}").sharedAccessKey("{{sharedAccessKey}}"));
+    }
+}
diff --git a/examples/azure-eventhubs/src/main/resources/application.properties b/examples/azure-eventhubs/src/main/resources/application.properties
new file mode 100644
index 0000000..6a81e83
--- /dev/null
+++ b/examples/azure-eventhubs/src/main/resources/application.properties
@@ -0,0 +1,29 @@
+## ---------------------------------------------------------------------------
+## 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 = Azure-Eventhubs
+
+# properties used in the route
+namespaceName=
+eventhubName=
+sharedAccessName=
+sharedAccessKey=
+blobAccountName=
+blobContainerName=
+blobAccessKey=
diff --git a/examples/azure-eventhubs/src/main/resources/logback.xml b/examples/azure-eventhubs/src/main/resources/logback.xml
new file mode 100644
index 0000000..a798d0b
--- /dev/null
+++ b/examples/azure-eventhubs/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] 04/04: Regen

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

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

commit a7de550bac71aeb4d6644bc292e8a31464b6c2a1
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 16 07:55:00 2021 +0200

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

diff --git a/examples/README.adoc b/examples/README.adoc
index bc09f11..cac1460 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: 90 (0 deprecated)
+Number of Examples: 91 (0 deprecated)
 
 [width="100%",cols="4,2,4",options="header"]
 |===
@@ -25,6 +25,8 @@ Number of Examples: 90 (0 deprecated)
 
 | link:aws-secrets-manager/README.adoc[Aws Secrets Manager] (aws-secrets-manager) | Beginner | An example for showing AWS Secrets Manager Camel component
 
+| link:azure-eventhubs/README.adoc[Azure Eventhubs] (azure-eventhubs) | Beginner | Azure Eventhubs example
+
 | link:azure-storage-blob/README.adoc[Azure Storage Blob] (azure-storage-blob) | Beginner | Azure Storage Blob example
 
 | link:basic/README.adoc[Basic] (basic) | Beginner | Basic example

[camel-examples] 02/04: Added Azure Eventhubs example to module

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

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

commit 2676b1c33298998dcf2f0baf61befa268f44b73e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 16 07:51:51 2021 +0200

    Added Azure Eventhubs example to module
---
 examples/pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/pom.xml b/examples/pom.xml
index 0b0493f..5aaf3e5 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -87,6 +87,7 @@
         <module>artemis-large-messages</module>
         <module>as2</module>
         <module>aws</module>
+        <module>azure-eventhubs</module>
         <module>azure-storage-blob</module>
         <module>basic</module>
         <module>billboard-aggregate</module>

[camel-examples] 03/04: Camel-Azure-Eventhubs: Changed the event message

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

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

commit 93cb89ecbda5d7a2154bd139c613dd940bfc0d12
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 16 07:53:02 2021 +0200

    Camel-Azure-Eventhubs: Changed the event message
---
 .../src/main/java/org/apache/camel/example/MyRouteBuilder.java          | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java b/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java
index bbab81a..cfa6066 100644
--- a/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java
+++ b/examples/azure-eventhubs/src/main/java/org/apache/camel/example/MyRouteBuilder.java
@@ -33,7 +33,7 @@ public class MyRouteBuilder extends EndpointRouteBuilder {
         from(azureEventhubs("{{namespaceName}}/{{eventhubName}}").sharedAccessKey("{{sharedAccessKey}}").sharedAccessName("{{sharedAccessName}}").blobAccessKey("{{blobAccessKey}}").blobAccountName("{{blobAccountName}}").blobContainerName("{{blobContainerName}}"))
                 .log("The content is ${body}");
 
-        from(timer("tick").period(1000)).setBody(constant("ciao"))
+        from(timer("tick").period(1000)).setBody(constant("Event Test"))
                 .to(azureEventhubs("{{namespaceName}}/{{eventhubName}}").sharedAccessName("{{sharedAccessName}}").sharedAccessKey("{{sharedAccessKey}}"));
     }
 }