You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2016/10/26 09:51:45 UTC
[1/3] camel git commit: CAMEL-10358: Adding an example about how to
use LiveReload with Camel and Spring-Boot
Repository: camel
Updated Branches:
refs/heads/camel-2.18.x dbeba1771 -> 5e5a0a693
CAMEL-10358: Adding an example about how to use LiveReload with Camel and Spring-Boot
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7231a595
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7231a595
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7231a595
Branch: refs/heads/camel-2.18.x
Commit: 7231a59564c1c4fa206fe39e3b39f190fa232f63
Parents: dbeba17
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Wed Oct 26 11:14:20 2016 +0200
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Wed Oct 26 11:21:26 2016 +0200
----------------------------------------------------------------------
.../pom.xml | 106 +++++++++++++++++++
.../readme.adoc | 23 ++++
.../livereload/LiveReloadApplication.java | 37 +++++++
.../springboot/livereload/LiveReloadRouter.java | 46 ++++++++
.../src/main/resources/application.properties | 25 +++++
examples/pom.xml | 1 +
6 files changed, 238 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/camel-example-spring-boot-live-reload/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/pom.xml b/examples/camel-example-spring-boot-live-reload/pom.xml
new file mode 100644
index 0000000..03e1886
--- /dev/null
+++ b/examples/camel-example-spring-boot-live-reload/pom.xml
@@ -0,0 +1,106 @@
+<?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</groupId>
+ <artifactId>examples</artifactId>
+ <version>2.19.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-spring-boot-live-reload</artifactId>
+ <name>Camel :: Example :: Spring Boot Live Reload</name>
+ <description>An example showing how to use the live reload feature of Spring Boot with Camel</description>
+
+ <properties>
+ <spring.boot-version>${spring-boot-version}</spring.boot-version>
+ </properties>
+
+ <!-- import 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</groupId>
+ <artifactId>camel-spring-boot-dependencies</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+
+ <!-- Spring-Boot -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <optional>true</optional>
+ </dependency>
+
+ <!-- Camel -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring-boot-starter</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jetty-starter</artifactId>
+ </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</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <fork>true</fork>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/camel-example-spring-boot-live-reload/readme.adoc
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/readme.adoc b/examples/camel-example-spring-boot-live-reload/readme.adoc
new file mode 100644
index 0000000..e051c37
--- /dev/null
+++ b/examples/camel-example-spring-boot-live-reload/readme.adoc
@@ -0,0 +1,23 @@
+= Spring Boot Camel LiveReload Sample
+
+This example shows how to use the live reload feature of Spring Boot with Apache Camel.
+
+The example exposes a rest endpoint on http://localhost:8080/.
+The route can be tested with a browser having the LiveReload extension installed.
+LiveReload browser extensions are freely available for the most popular browsers from http://livereload.com[livereload.com].
+
+The example should be launched with the following maven command:
+
+ mvn clean install spring-boot:run
+
+Once the application is started, you can visit http://localhost:8080/ with a browser and activate the LiveReload feature
+(usually, by clicking on the extension's icon).
+
+Changing the source code (eg. changing the default message returned by the route) will produce a refresh in the browser.
+When using IntelliJ Idea, after doing the changes, you should compile the project (eg. by clicking on the _"Make Project"_ button)
+in order to see the changes in the browser.
+
+== More information
+
+You can find more information about Apache Camel at the website: http://camel.apache.org/.
+You can find more information about the LiveReload feature in the http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html[dev tools documentation].
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadApplication.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadApplication.java b/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadApplication.java
new file mode 100644
index 0000000..20547c7
--- /dev/null
+++ b/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadApplication.java
@@ -0,0 +1,37 @@
+/**
+ * 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.springboot.livereload;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+//CHECKSTYLE:OFF
+/**
+ * A sample Spring Boot application that starts the Camel routes.
+ */
+@SpringBootApplication
+public class LiveReloadApplication {
+
+ /**
+ * A main method to start this application.
+ */
+ public static void main(String[] args) {
+ SpringApplication.run(LiveReloadApplication.class, args);
+ }
+
+}
+//CHECKSTYLE:ON
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadRouter.java
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadRouter.java b/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadRouter.java
new file mode 100644
index 0000000..3c77e02
--- /dev/null
+++ b/examples/camel-example-spring-boot-live-reload/src/main/java/org/apache/camel/example/springboot/livereload/LiveReloadRouter.java
@@ -0,0 +1,46 @@
+/**
+ * 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.springboot.livereload;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * A simple Camel route that exposes a text/plain REST endpoint returning a simple message.
+ * <p/>
+ * Use <tt>@Component</tt> to make Camel auto detect this route when starting.
+ */
+@Component
+public class LiveReloadRouter extends RouteBuilder {
+
+ @Value("${port}")
+ private Integer port;
+
+ @Override
+ public void configure() throws Exception {
+
+ restConfiguration().port(port);
+
+ rest().get("/")
+ .produces("text/plain")
+ .route()
+ .transform().constant("Change me");
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/camel-example-spring-boot-live-reload/src/main/resources/application.properties
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/src/main/resources/application.properties b/examples/camel-example-spring-boot-live-reload/src/main/resources/application.properties
new file mode 100644
index 0000000..718de5c
--- /dev/null
+++ b/examples/camel-example-spring-boot-live-reload/src/main/resources/application.properties
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+
+# Name of the Camel app
+camel.springboot.name = SampleCamelLiveReload
+
+# The server port
+port=8080
+
+# Enable live reload
+spring.devtools.livereload.enabled=true
http://git-wip-us.apache.org/repos/asf/camel/blob/7231a595/examples/pom.xml
----------------------------------------------------------------------
diff --git a/examples/pom.xml b/examples/pom.xml
index cbb0e8b..0397343 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -80,6 +80,7 @@
<module>camel-example-splunk</module>
<module>camel-example-spring</module>
<module>camel-example-spring-boot</module>
+ <module>camel-example-spring-boot-live-reload</module>
<module>camel-example-spring-boot-metrics</module>
<module>camel-example-spring-boot-rest-jpa</module>
<module>camel-example-spring-boot-starter</module>
[3/3] camel git commit: CAMEL-10358: Backporting example for 2.18.x
Posted by nf...@apache.org.
CAMEL-10358: Backporting example for 2.18.x
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5e5a0a69
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5e5a0a69
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5e5a0a69
Branch: refs/heads/camel-2.18.x
Commit: 5e5a0a693c4ea457f93866c75656aedd52948951
Parents: 4a44e20
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Wed Oct 26 11:51:08 2016 +0200
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Wed Oct 26 11:51:08 2016 +0200
----------------------------------------------------------------------
examples/camel-example-spring-boot-live-reload/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5e5a0a69/examples/camel-example-spring-boot-live-reload/pom.xml
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/pom.xml b/examples/camel-example-spring-boot-live-reload/pom.xml
index 03e1886..88006d2 100644
--- a/examples/camel-example-spring-boot-live-reload/pom.xml
+++ b/examples/camel-example-spring-boot-live-reload/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>examples</artifactId>
- <version>2.19.0-SNAPSHOT</version>
+ <version>2.18.1-SNAPSHOT</version>
</parent>
<artifactId>camel-example-spring-boot-live-reload</artifactId>
[2/3] camel git commit: CAMEL-10358: Fixing docs
Posted by nf...@apache.org.
CAMEL-10358: Fixing docs
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4a44e20c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4a44e20c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4a44e20c
Branch: refs/heads/camel-2.18.x
Commit: 4a44e20c986178b3518a4c1acfa1b84aa8cde170
Parents: 7231a59
Author: Nicola Ferraro <ni...@gmail.com>
Authored: Wed Oct 26 11:19:17 2016 +0200
Committer: Nicola Ferraro <ni...@gmail.com>
Committed: Wed Oct 26 11:21:35 2016 +0200
----------------------------------------------------------------------
examples/camel-example-spring-boot-live-reload/readme.adoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/4a44e20c/examples/camel-example-spring-boot-live-reload/readme.adoc
----------------------------------------------------------------------
diff --git a/examples/camel-example-spring-boot-live-reload/readme.adoc b/examples/camel-example-spring-boot-live-reload/readme.adoc
index e051c37..3498a68 100644
--- a/examples/camel-example-spring-boot-live-reload/readme.adoc
+++ b/examples/camel-example-spring-boot-live-reload/readme.adoc
@@ -20,4 +20,4 @@ in order to see the changes in the browser.
== More information
You can find more information about Apache Camel at the website: http://camel.apache.org/.
-You can find more information about the LiveReload feature in the http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html[dev tools documentation].
+For information about the LiveReload feature, check the http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html[dev tools documentation].