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-spring-boot-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 4b00e2c  Add Spring Boot samples for Azure (#87)
4b00e2c is described below

commit 4b00e2c22791f913715d38434427797843292920
Author: Yonghui Ye <[email protected]>
AuthorDate: Tue Sep 20 20:04:30 2022 +0800

    Add Spring Boot samples for Azure (#87)
    
    * add azure samples
    
    * add blank line
    
    * add readme
    
    * update comment
    
    * update indentation
    
    * update pom indentation
---
 .../README.adoc                                    | 50 +++++++++++++
 .../pom.xml                                        | 74 ++++++++++++++++++++
 .../java/camel/sample/EventhubsRouteBuilder.java   | 48 +++++++++++++
 .../main/java/camel/sample/MessageReceiver.java    | 33 +++++++++
 .../sample/SampleCamelEventhubsApplication.java    | 31 +++++++++
 .../src/main/resources/application.yml             | 26 +++++++
 .../README.adoc                                    | 48 +++++++++++++
 .../pom.xml                                        | 81 ++++++++++++++++++++++
 .../main/java/sample/camel/MessageReceiver.java    | 32 +++++++++
 .../camel/SampleCamelServicebusJmsApplication.java | 50 +++++++++++++
 .../sample/camel/ServicebusJmsRouteBuilder.java    | 48 +++++++++++++
 .../src/main/resources/application.yml             | 28 ++++++++
 .../README.adoc                                    | 48 +++++++++++++
 .../pom.xml                                        | 74 ++++++++++++++++++++
 .../main/java/camel/sample/MessageReceiver.java    | 32 +++++++++
 .../sample/SampleCamelServiceBusApplication.java   | 29 ++++++++
 .../java/camel/sample/ServicebusRouteBuilder.java  | 44 ++++++++++++
 .../src/main/resources/application.yml             | 27 ++++++++
 azure/pom.xml                                      | 69 ++++++++++++++++++
 pom.xml                                            |  1 +
 20 files changed, 873 insertions(+)

diff --git a/azure/camel-example-spring-boot-azure-eventhubs/README.adoc 
b/azure/camel-example-spring-boot-azure-eventhubs/README.adoc
new file mode 100644
index 0000000..9cae365
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-eventhubs/README.adoc
@@ -0,0 +1,50 @@
+== Spring Boot Example with Azure Event Hubs
+
+=== Introduction
+
+This example demonstrates how you can use the Camel Azure Event Hubs Starter 
component.
+
+NOTE: Running this sample will be charged by Azure. You can check the usage 
and bill at this https://azure.microsoft.com/get-started/azure-portal/[link].
+
+=== Create Event Hubs on Azure
+
+1. Create an Azure Event Hubs by following this 
https://learn.microsoft.com/azure/event-hubs/event-hubs-create[link].
+
+2. Create an Azure Storage account for checkpoint use by following this 
https://learn.microsoft.com/azure/storage/common/storage-account-create?tabs=azure-portal[link].
+
+=== Configuration
+
+You need to configure the details in the file:
+
+`src/main/resources/application.yml`
+
+=== How to run
+
+Run this example using:
+
+[source,console]
+----
+mvn spring-boot:run
+----
+
+You should see the following output in the console.
+
+[source,console]
+----
+Received: Event Test
+The content is Event Test
+...
+Received: Event Test
+The content is Event Test
+...
+----
+
+=== 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/azure/camel-example-spring-boot-azure-eventhubs/pom.xml 
b/azure/camel-example-spring-boot-azure-eventhubs/pom.xml
new file mode 100644
index 0000000..2c79771
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-eventhubs/pom.xml
@@ -0,0 +1,74 @@
+<?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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.springboot.example</groupId>
+    <artifactId>camel-example-spring-boot-azure</artifactId>
+    <version>3.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-spring-boot-azure-eventhubs</artifactId>
+  <name>Camel SB Examples :: Azure Event Hubs</name>
+  <description>An example showing how to work with Camel, Azure Event Hubs and 
Spring Boot</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <!-- Camel -->
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-azure-eventhubs-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-endpointdsl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring-boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git 
a/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/EventhubsRouteBuilder.java
 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/EventhubsRouteBuilder.java
new file mode 100644
index 0000000..a3555d3
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/EventhubsRouteBuilder.java
@@ -0,0 +1,48 @@
+/*
+ * 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 camel.sample;
+
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class EventhubsRouteBuilder extends EndpointRouteBuilder {
+
+    @Value("${namespaceName}")
+    private String namespaceName;
+
+    @Value("${eventhubsName}")
+    private String eventhubsName;
+
+    @Autowired
+    private MessageReceiver receiver;
+
+    @Override
+    public void configure() {
+        from(timer("tick")
+            .period(1000))
+            .setBody(constant("Event Test"))
+            .to(azureEventhubs(namespaceName + "/" + eventhubsName));
+
+        from(azureEventhubs(namespaceName + "/" + eventhubsName))
+            .bean(receiver)
+            .log("The content is ${body}");
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/MessageReceiver.java
 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/MessageReceiver.java
new file mode 100644
index 0000000..ccd312b
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/MessageReceiver.java
@@ -0,0 +1,33 @@
+/*
+ * 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 camel.sample;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class MessageReceiver {
+
+    private static final Logger logger = 
LoggerFactory.getLogger(MessageReceiver.class);
+
+    public void onMessage(String message) {
+        logger.info("Received: {}", message);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/SampleCamelEventhubsApplication.java
 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/SampleCamelEventhubsApplication.java
new file mode 100644
index 0000000..17ff3c8
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/java/camel/sample/SampleCamelEventhubsApplication.java
@@ -0,0 +1,31 @@
+/*
+ * 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 camel.sample;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SampleCamelEventhubsApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SampleCamelEventhubsApplication.class, args);
+    }
+
+}
+
+
diff --git 
a/azure/camel-example-spring-boot-azure-eventhubs/src/main/resources/application.yml
 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/resources/application.yml
new file mode 100644
index 0000000..49f88c8
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-eventhubs/src/main/resources/application.yml
@@ -0,0 +1,26 @@
+# 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.
+#
+camel:
+  component:
+    azure-eventhubs:
+        # connectionstring for eventhubs instance, with 
;EntityPath=<eventhub-name> in the end
+      connection-string: 
[EVENT_HUBS_CONNECTION_STRING];EntityPath=[EVENT_HUB_NAME]
+      blob-account-name: [STORAGE_ACCOUNT_NAME]
+      blob-access-key: [STORAGE_ACCOUNT_ACCESS_KEY]
+      blob-container-name: [STORAGE_CONTAINER_NAME]
+
+namespaceName: [EVENT_HUBS_NAMESPACE]
+eventhubsName: [EVENT_HUB_NAME]
diff --git a/azure/camel-example-spring-boot-azure-servicebus-jms/README.adoc 
b/azure/camel-example-spring-boot-azure-servicebus-jms/README.adoc
new file mode 100644
index 0000000..b73f0c2
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-servicebus-jms/README.adoc
@@ -0,0 +1,48 @@
+== Spring Boot Example with Azure Service Bus JMS
+
+=== Introduction
+
+This example shows how to work with a simple Apache Camel application using 
Spring Boot with Spring JMS and Azure Service Bus Queue.
+
+NOTE: Running this sample will be charged by Azure. You can check the usage 
and bill at this https://azure.microsoft.com/get-started/azure-portal/[link].
+
+=== Create Service Bus on Azure
+
+Create an Azure Service Bus namespace and queue by following this 
https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quickstart-portal[link].
+
+=== Configuration
+
+You need to configure the details in the file:
+
+`src/main/resources/application.yml`
+
+=== How to run
+
+Run this example using:
+
+[source,console]
+----
+mvn spring-boot:run
+----
+
+You should see the following output in the console.
+
+[source,console]
+----
+Received: Service Bus JMS Test
+Connection ID: ... connected to server: ...
+...
+Received: Service Bus JMS Test
+Connection ID: ... connected to server: ...
+...
+----
+
+=== 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/azure/camel-example-spring-boot-azure-servicebus-jms/pom.xml 
b/azure/camel-example-spring-boot-azure-servicebus-jms/pom.xml
new file mode 100644
index 0000000..1f8ebe5
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-servicebus-jms/pom.xml
@@ -0,0 +1,81 @@
+<?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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.springboot.example</groupId>
+    <artifactId>camel-example-spring-boot-azure</artifactId>
+    <version>3.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-spring-boot-azure-servicebus-jms</artifactId>
+  <name>Camel SB Examples :: Azure Service Bus JMS</name>
+  <description>An example showing how to work with Camel, Azure Service Bus 
JMS and Spring Boot</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <!-- Camel -->
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-jms-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-endpointdsl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- Qpid JMS -->
+    <dependency>
+      <groupId>org.apache.qpid</groupId>
+      <artifactId>qpid-jms-client</artifactId>
+      <version>1.6.0</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring-boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/MessageReceiver.java
 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/MessageReceiver.java
new file mode 100644
index 0000000..1a1f81c
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/MessageReceiver.java
@@ -0,0 +1,32 @@
+/*
+ * 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 sample.camel;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MessageReceiver {
+
+    private static final Logger logger = 
LoggerFactory.getLogger(MessageReceiver.class);
+
+    public void onMessage(String message) {
+        logger.info("Received: {}", message);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/SampleCamelServicebusJmsApplication.java
 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/SampleCamelServicebusJmsApplication.java
new file mode 100644
index 0000000..c2c0f31
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/SampleCamelServicebusJmsApplication.java
@@ -0,0 +1,50 @@
+/*
+ * 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 sample.camel;
+
+import org.apache.camel.component.jms.springboot.JmsComponentConfiguration;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+
+import javax.jms.ConnectionFactory;
+
+@SpringBootApplication
+public class SampleCamelServicebusJmsApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SampleCamelServicebusJmsApplication.class, args);
+    }
+
+    private static final String AMQP_URI_FORMAT = 
"amqps://%s?amqp.idleTimeout=%d";
+
+    @Value("${hostName}")
+    private String hostName;
+
+    private static final long idleTimeout = 1800000;
+
+    @Bean
+    public ConnectionFactory jmsConnectionFactory(JmsComponentConfiguration 
conf) {
+        String username = conf.getConfiguration().getUsername();
+        String password = conf.getConfiguration().getPassword();
+        String remoteUri = String.format(AMQP_URI_FORMAT, hostName, 
idleTimeout);
+        return new JmsConnectionFactory(username, password, remoteUri);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/ServicebusJmsRouteBuilder.java
 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/ServicebusJmsRouteBuilder.java
new file mode 100644
index 0000000..9db2e68
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/java/sample/camel/ServicebusJmsRouteBuilder.java
@@ -0,0 +1,48 @@
+/*
+ * 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 sample.camel;
+
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.jms.ConnectionFactory;
+
+@Component
+public class ServicebusJmsRouteBuilder extends EndpointRouteBuilder {
+
+    @Autowired
+    private MessageReceiver receiver;
+
+    @Autowired
+    private ConnectionFactory connectionFactory;
+
+    @Value("${queueName}")
+    private String queueName;
+
+    @Override
+    public void configure() {
+        from(timer("tick").period(1000))
+            .setBody(constant("Service Bus JMS Test"))
+            .to(jms(queueName).connectionFactory(connectionFactory));
+
+        from(jms(queueName).connectionFactory(connectionFactory)).
+            bean(receiver);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/resources/application.yml
 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/resources/application.yml
new file mode 100644
index 0000000..dea7d06
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus-jms/src/main/resources/application.yml
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+camel:
+  component:
+    jms:
+      configuration:
+        # username SharedAccessKeyName from connection-string
+        username: [Shared_Access_Key_Name]
+        # password SharedAccessKey from connection-string
+        password: [Shared_Access_Key]
+
+queueName: [SERVICE_BUS_QUEUE_NAME]
+#the format is like: <namespacename>.servicebus.windows.net
+hostName: [SERVICE_BUS_HOST_NAME]
diff --git a/azure/camel-example-spring-boot-azure-servicebus/README.adoc 
b/azure/camel-example-spring-boot-azure-servicebus/README.adoc
new file mode 100644
index 0000000..6e18cdf
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-servicebus/README.adoc
@@ -0,0 +1,48 @@
+== Spring Boot Example with Azure Service Bus
+
+=== Introduction
+
+This example demonstrates how you can use the Camel Azure Service Bus Starter 
component.
+
+NOTE: Running this sample will be charged by Azure. You can check the usage 
and bill at this https://azure.microsoft.com/get-started/azure-portal/[link].
+
+=== Create Service Bus on Azure
+
+Create an Azure Service Bus namespace and queue by following this 
https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quickstart-portal[link].
+
+=== Configuration
+
+You need to configure the details in the file:
+
+`src/main/resources/application.yml`
+
+=== How to run
+
+Run this example using:
+
+[source,console]
+----
+mvn spring-boot:run
+----
+
+You should see the following output in the console.
+
+[source,console]
+----
+Received: Service Bus Test
+The content is Service Bus Test
+...
+Received: Service Bus Test
+The content is Service Bus Test
+...
+----
+
+=== 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/azure/camel-example-spring-boot-azure-servicebus/pom.xml 
b/azure/camel-example-spring-boot-azure-servicebus/pom.xml
new file mode 100644
index 0000000..892a875
--- /dev/null
+++ b/azure/camel-example-spring-boot-azure-servicebus/pom.xml
@@ -0,0 +1,74 @@
+<?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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.springboot.example</groupId>
+    <artifactId>camel-example-spring-boot-azure</artifactId>
+    <version>3.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-spring-boot-azure-servicebus</artifactId>
+  <name>Camel SB Examples :: Azure Service Bus</name>
+  <description>An example showing how to work with Camel, Azure Service Bus 
and Spring Boot</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.springframework.boot</groupId>
+      <artifactId>spring-boot-starter</artifactId>
+    </dependency>
+
+    <!-- Camel -->
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-spring-boot-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel.springboot</groupId>
+      <artifactId>camel-azure-servicebus-starter</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-endpointdsl</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-maven-plugin</artifactId>
+        <version>${spring-boot-version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>repackage</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/MessageReceiver.java
 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/MessageReceiver.java
new file mode 100644
index 0000000..4fe9ffa
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/MessageReceiver.java
@@ -0,0 +1,32 @@
+/*
+ * 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 camel.sample;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MessageReceiver {
+
+    private static final Logger logger = 
LoggerFactory.getLogger(MessageReceiver.class);
+
+    public void onMessage(String message) {
+        logger.info("Received: {}", message);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/SampleCamelServiceBusApplication.java
 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/SampleCamelServiceBusApplication.java
new file mode 100644
index 0000000..865d460
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/SampleCamelServiceBusApplication.java
@@ -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.
+ */
+package camel.sample;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SampleCamelServiceBusApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(SampleCamelServiceBusApplication.class, args);
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/ServicebusRouteBuilder.java
 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/ServicebusRouteBuilder.java
new file mode 100644
index 0000000..e0e36d6
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/java/camel/sample/ServicebusRouteBuilder.java
@@ -0,0 +1,44 @@
+/*
+ * 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 camel.sample;
+
+import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ServicebusRouteBuilder extends EndpointRouteBuilder {
+
+    @Autowired
+    private MessageReceiver receiver;
+
+    @Value("${queueName}")
+    private String queueName;
+
+    @Override
+    public void configure() {
+        from(timer("tick").period(1000))
+            .setBody(constant("Service Bus Test"))
+            .to(azureServicebus(queueName));
+
+        from(azureServicebus(queueName))
+            .bean(receiver)
+            .log("The content is ${body}");
+    }
+
+}
diff --git 
a/azure/camel-example-spring-boot-azure-servicebus/src/main/resources/application.yml
 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/resources/application.yml
new file mode 100644
index 0000000..cad6033
--- /dev/null
+++ 
b/azure/camel-example-spring-boot-azure-servicebus/src/main/resources/application.yml
@@ -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.
+#
+spring:
+  output:
+    ansi:
+      enabled: ALWAYS
+camel:
+  component:
+    azure-servicebus:
+        connection-string: [SERVICEBUS_CONNECTION_STRING]
+        service-bus-type: queue
+
+queueName: [SERVICEBUS_QUEUE_NAME]
diff --git a/azure/pom.xml b/azure/pom.xml
new file mode 100644
index 0000000..d75c21f
--- /dev/null
+++ b/azure/pom.xml
@@ -0,0 +1,69 @@
+<?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/xsd/maven-4.0.0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel.springboot.example</groupId>
+    <artifactId>examples</artifactId>
+    <version>3.19.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-spring-boot-azure</artifactId>
+  <packaging>pom</packaging>
+  <name>Camel SB Examples :: Azure</name>
+  <description>An example showing the Camel Azure component with Spring 
Boot</description>
+
+  <properties>
+    <maven.compiler.source>8</maven.compiler.source>
+    <maven.compiler.target>8</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+  </properties>
+
+  <!-- Spring-Boot and Camel BOM -->
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-dependencies</artifactId>
+        <version>${spring-boot-version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.camel.springboot</groupId>
+        <artifactId>camel-spring-boot-bom</artifactId>
+        <version>${project.version}</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <modules>
+    <module>camel-example-spring-boot-azure-servicebus-jms</module>
+    <module>camel-example-spring-boot-azure-servicebus</module>
+    <module>camel-example-spring-boot-azure-eventhubs</module>
+  </modules>
+
+</project>
diff --git a/pom.xml b/pom.xml
index 7a7a54d..e3867ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,6 +92,7 @@
                <module>splitter-eip</module>
                <module>widget-gadget</module>
                <module>unit-testing</module>
+               <module>azure</module>
     </modules>
 
        <properties>


Reply via email to