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 2020/05/15 06:01:50 UTC

[camel-spring-boot] branch master updated (63eb3ef -> 30ec4ee)

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


    from 63eb3ef  CAMEL-15056: camel-main: provide a way to bring a custom engine to control shutdown logic
     new dca815f  Widget-Gadget example with SpringBoot
     new d4b6d22  Added widget-gadget module
     new 30ec4ee  Added license statements

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:
 .../pom.xml                                        | 26 +++++++++++++--------
 .../src/main/data/order1.json                      |  7 ++++++
 .../src/main/data/order2.json                      |  7 ++++++
 .../src/main/java/sample/camel/AmqpConfig.java     | 27 ++++------------------
 .../src/main/java/sample/camel/OrderRoute.java}    | 15 ++++++------
 .../main/java/sample/camel/WidgetGadgetApp.java}   |  7 ++----
 .../main/java/sample/camel/WidgetGadgetRoute.java  | 20 ++++++++++------
 .../src/main}/resources/application.properties     |  5 +++-
 examples/pom.xml                                   |  1 +
 9 files changed, 63 insertions(+), 52 deletions(-)
 copy examples/{camel-example-spring-boot-amqp => camel-example-spring-boot-widget-gadget}/pom.xml (87%)
 create mode 100644 examples/camel-example-spring-boot-widget-gadget/src/main/data/order1.json
 create mode 100644 examples/camel-example-spring-boot-widget-gadget/src/main/data/order2.json
 copy examples/{camel-example-spring-boot-amqp => camel-example-spring-boot-widget-gadget}/src/main/java/sample/camel/AmqpConfig.java (75%)
 copy examples/{camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java => camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/OrderRoute.java} (76%)
 copy examples/{camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAmqApplication.java => camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java} (88%)
 copy core/camel-spring-boot/src/test/java/org/apache/camel/spring/boot/componentroute/ComponentRoute.java => examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java (66%)
 copy {components-starter/camel-infinispan-starter/src/test => examples/camel-example-spring-boot-widget-gadget/src/main}/resources/application.properties (88%)


[camel-spring-boot] 02/03: Added widget-gadget 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-spring-boot.git

commit d4b6d22842e3f2a542e556db0fc3b5a72681ba67
Author: akoufoudakis <ak...@gmail.com>
AuthorDate: Thu May 14 18:29:37 2020 +0200

    Added widget-gadget module
---
 examples/pom.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/examples/pom.xml b/examples/pom.xml
index bd30194..2ab89ac 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -74,6 +74,7 @@
         <module>camel-example-spring-boot-strimzi</module>
         <module>camel-example-spring-cloud-servicecall</module>
         <module>camel-example-spring-cloud-serviceregistry</module>
+        <module>camel-example-spring-boot-widget-gadget</module>
     </modules>
 
     <properties>


[camel-spring-boot] 01/03: Widget-Gadget example with SpringBoot

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

commit dca815f222f7d13627ae0d95d77a222dd0a71c95
Author: akoufoudakis <ak...@gmail.com>
AuthorDate: Thu May 14 18:27:52 2020 +0200

    Widget-Gadget example with SpringBoot
---
 .../pom.xml                                        | 139 +++++++++++++++++++++
 .../src/main/data/order1.json                      |   7 ++
 .../src/main/data/order2.json                      |   7 ++
 .../src/main/java/sample/camel/AmqpConfig.java     |  67 ++++++++++
 .../src/main/java/sample/camel/OrderRoute.java     |  36 ++++++
 .../main/java/sample/camel/WidgetGadgetApp.java    |  11 ++
 .../main/java/sample/camel/WidgetGadgetRoute.java  |  26 ++++
 .../src/main/resources/application.properties      |   4 +
 8 files changed, 297 insertions(+)

diff --git a/examples/camel-example-spring-boot-widget-gadget/pom.xml b/examples/camel-example-spring-boot-widget-gadget/pom.xml
new file mode 100644
index 0000000..397f575
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/pom.xml
@@ -0,0 +1,139 @@
+<?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">
+    <parent>
+        <artifactId>examples</artifactId>
+        <groupId>org.apache.camel.springboot.example</groupId>
+        <version>3.3.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>camel-example-spring-boot-widget-gadget</artifactId>
+    <name>Camel SB Examples :: </name>
+    <description>The widget and gadget example from EIP book, running on Spring Boot</description>
+
+    <properties>
+        <category>Messaging</category>
+
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <spring.boot-version>${spring-boot-version}</spring.boot-version>
+    </properties>
+
+    <dependencyManagement>
+
+        <dependencies>
+            <!-- Spring Boot BOM -->
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring.boot-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+            <!-- Camel BOM -->
+            <dependency>
+                <groupId>org.apache.camel.springboot</groupId>
+                <artifactId>camel-spring-boot-dependencies</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+
+    </dependencyManagement>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-amqp-starter</artifactId>
+        </dependency>
+
+        <!-- Camel -->
+        <dependency>
+            <groupId>org.apache.camel.springboot</groupId>
+            <artifactId>camel-spring-boot-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-amqp</artifactId>
+            <version>${camel-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-jsonpath</artifactId>
+            <version>${camel-version}</version>
+        </dependency>
+
+
+        <!-- test -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test-spring</artifactId>
+            <version>${camel-version}</version>
+            <scope>test</scope>
+        </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>
\ No newline at end of file
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/data/order1.json b/examples/camel-example-spring-boot-widget-gadget/src/main/data/order1.json
new file mode 100644
index 0000000..37579f8
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/data/order1.json
@@ -0,0 +1,7 @@
+{ "__comment__": "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 [...]
+  "order" : {
+    "customerId": "123",
+    "product": "widget",
+    "amount": "2"
+  }
+}
\ No newline at end of file
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/data/order2.json b/examples/camel-example-spring-boot-widget-gadget/src/main/data/order2.json
new file mode 100644
index 0000000..6d442de
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/data/order2.json
@@ -0,0 +1,7 @@
+{ "__comment__": "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 [...]
+  "order" : {
+    "customerId": "456",
+    "product": "gadget",
+    "amount": "3"
+  }
+}
\ No newline at end of file
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/AmqpConfig.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/AmqpConfig.java
new file mode 100644
index 0000000..326277c
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/AmqpConfig.java
@@ -0,0 +1,67 @@
+/*
+ * 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.qpid.jms.JmsConnectionFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AmqpConfig {
+
+    @Value("${AMQP_SERVICE_USERNAME}")
+    private String userName;
+    @Value("${AMQP_SERVICE_PASSWORD}")
+    private String pass;
+    @Value("${AMQP_REMOTE_URI}")
+    private String remoteUri;
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPass() {
+        return pass;
+    }
+
+    public void setPass(String pass) {
+        this.pass = pass;
+    }
+
+    public String getRemoteUri() {
+        return remoteUri;
+    }
+
+    public void setRemoteUri(String remoteUri) {
+        this.remoteUri = remoteUri;
+    }
+
+    @Bean
+    public JmsConnectionFactory amqpConnectionFactory() {
+        JmsConnectionFactory jmsConnectionFactory = new JmsConnectionFactory();
+        jmsConnectionFactory.setRemoteURI(remoteUri);
+        jmsConnectionFactory.setUsername(userName);
+        jmsConnectionFactory.setPassword(pass);
+        return jmsConnectionFactory;
+    }
+
+}
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/OrderRoute.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/OrderRoute.java
new file mode 100644
index 0000000..3a860a7
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/OrderRoute.java
@@ -0,0 +1,36 @@
+/*
+ * 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.RouteBuilder;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class OrderRoute extends RouteBuilder {
+
+    @Autowired
+    JmsConnectionFactory amqpConnectionFactory;
+
+    @Override
+    public void configure() throws Exception {
+        from("file:src/main/data?noop=true")
+                .to("amqp:queue:order.queue");
+    }
+
+}
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java
new file mode 100644
index 0000000..c8df269
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java
@@ -0,0 +1,11 @@
+package sample.camel;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class WidgetGadgetApp {
+    public static void main(String[] args) {
+        SpringApplication.run(WidgetGadgetApp.class, args);
+    }
+}
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java
new file mode 100644
index 0000000..e668b38
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java
@@ -0,0 +1,26 @@
+package sample.camel;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.qpid.jms.JmsConnectionFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WidgetGadgetRoute extends RouteBuilder {
+
+    @Autowired
+    JmsConnectionFactory amqpConnectionFactory;
+
+    @Override
+    public void configure() throws Exception {
+        from("amqp:queue:order.queue")
+                .choice()
+                    .when().jsonpath("$.order[?(@.product=='widget')]")
+                        .to("log:widget")
+                        .to("amqp:queue:widget.queue")
+                    .otherwise()
+                        .to("log:gadget")
+                        .to("amqp:queue:gadget.queue");
+    }
+
+}
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties b/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties
new file mode 100644
index 0000000..398de92
--- /dev/null
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties
@@ -0,0 +1,4 @@
+spring.artemis.mode=native
+AMQP_REMOTE_URI=amqp://localhost:5672
+AMQP_SERVICE_USERNAME=admin
+AMQP_SERVICE_PASSWORD=admin
\ No newline at end of file


[camel-spring-boot] 03/03: Added license statements

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

commit 30ec4eea442f7768cd90fdf532a332ebb8de75b5
Author: akoufoudakis <ak...@gmail.com>
AuthorDate: Thu May 14 19:15:00 2020 +0200

    Added license statements
---
 .../src/main/java/sample/camel/WidgetGadgetApp.java     | 16 ++++++++++++++++
 .../src/main/java/sample/camel/WidgetGadgetRoute.java   | 16 ++++++++++++++++
 .../src/main/resources/application.properties           | 17 +++++++++++++++++
 3 files changed, 49 insertions(+)

diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java
index c8df269..050bce8 100644
--- a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetApp.java
@@ -1,3 +1,19 @@
+/*
+ * 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.springframework.boot.SpringApplication;
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java
index e668b38..72b87f5 100644
--- a/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/java/sample/camel/WidgetGadgetRoute.java
@@ -1,3 +1,19 @@
+/*
+ * 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.RouteBuilder;
diff --git a/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties b/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties
index 398de92..f6cfb50 100644
--- a/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties
+++ b/examples/camel-example-spring-boot-widget-gadget/src/main/resources/application.properties
@@ -1,3 +1,20 @@
+## ---------------------------------------------------------------------------
+## 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.artemis.mode=native
 AMQP_REMOTE_URI=amqp://localhost:5672
 AMQP_SERVICE_USERNAME=admin