Repository: camel Updated Branches: refs/heads/master a055cd1ea -> 7162d79db
CAMEL-11311: Spring Boot with external ActiveMQ broker. Update according to review comments. Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7162d79d Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7162d79d Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7162d79d Branch: refs/heads/master Commit: 7162d79db6afb1ff0434f2a34b0177680088e109 Parents: 9e61146 Author: Preben Asmussen <preben.asmus...@gmail.com> Authored: Wed May 24 19:37:06 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu May 25 13:57:51 2017 +0200 ---------------------------------------------------------------------- examples/README.adoc | 4 +- .../camel-example-spring-boot-activemq/pom.xml | 148 +++++++++++++++++++ .../readme.adoc | 30 ++++ .../java/sample/camel/SampleAmqApplication.java | 32 ++++ .../sample/camel/SampleAutowiredAmqRoute.java | 35 +++++ .../src/main/resources/application.properties | 19 +++ .../sample/camel/SampleAmqApplicationTests.java | 43 ++++++ examples/camel-example-spring-boot-amq/pom.xml | 131 ---------------- .../camel-example-spring-boot-amq/readme.adoc | 23 --- .../java/sample/camel/SampleAmqApplication.java | 32 ---- .../sample/camel/SampleAutowiredAmqRoute.java | 35 ----- .../src/main/resources/application.properties | 17 --- .../sample/camel/SampleAmqApplicationTests.java | 43 ------ examples/pom.xml | 2 +- 14 files changed, 311 insertions(+), 283 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/README.adoc ---------------------------------------------------------------------- diff --git a/examples/README.adoc b/examples/README.adoc index 0f0dc96..3a3ac67 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: 91 (9 deprecated) +Number of Examples: 92 (9 deprecated) [width="100%",cols="4,2,4",options="header"] |======================================================================= @@ -44,6 +44,8 @@ Number of Examples: 91 (9 deprecated) | link:camel-example-spring-boot/readme.adoc[Spring Boot] (camel-example-spring-boot) | Beginner | An example showing how to work with Camel and Spring Boot +| link:camel-example-spring-boot-activemq/readme.adoc[Spring Boot Activemq] (camel-example-spring-boot-activemq) | Beginner | An example showing how to work with Camel, ActiveMQ and Spring Boot + | link:camel-example-spring-boot-live-reload/readme.adoc[Spring Boot Live Reload] (camel-example-spring-boot-live-reload) | Beginner | An example showing how to use the live reload feature of Spring Boot with Camel | link:camel-example-spring-javaconfig/README.md[Spring Java Config] (camel-example-spring-javaconfig) | Beginner | An example showing how to work with Camel and Spring Java Config http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/pom.xml ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/pom.xml b/examples/camel-example-spring-boot-activemq/pom.xml new file mode 100644 index 0000000..f38a285 --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/pom.xml @@ -0,0 +1,148 @@ +<?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</groupId> + <artifactId>examples</artifactId> + <version>2.20.0-SNAPSHOT</version> + </parent> + + <artifactId>camel-example-spring-boot-activemq</artifactId> + <name>Camel :: Example :: Spring Boot and ActiveMQ</name> + <description>An example showing how to work with Camel, ActiveMQ and Spring Boot</description> + + <properties> + <category>Beginner</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</groupId> + <artifactId>camel-spring-boot-dependencies</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + + </dependencyManagement> + + <dependencies> + + <!-- activemq --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-activemq</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-broker</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Camel --> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-spring-boot-starter</artifactId> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-camel</artifactId> + <!-- version>5.14.0</version--> + <exclusions> + <exclusion> + <groupId>org.apache.activemq</groupId> + <artifactId>activemq-broker</artifactId> + </exclusion> + </exclusions> + </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> + <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> + + <profiles> + <profile> + <id>jdk9-build</id> + <activation> + <jdk>9</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>--add-modules java.xml.bind --add-opens + java.base/java.lang=ALL-UNNAMED</argLine> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/readme.adoc ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/readme.adoc b/examples/camel-example-spring-boot-activemq/readme.adoc new file mode 100644 index 0000000..3853113 --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/readme.adoc @@ -0,0 +1,30 @@ +# Camel Example Spring Boot and ActiveMQ + +This example shows how to work with a simple Apache Camel application using Spring Boot and Apache ActiveMQ. + +## Preparing ActiveMQ brokers + +From Apache ActiveMQ you can download the broker as a .zip or .tar.gz file. + +Unzip/tar the archive, and start a terminal. + +Change directory to the unzipped directory and start the broker. + + bin/activemq console + +Which runs the broker in the foreground and logs to the console. + +## How to run the example + +You can run this example using + + mvn spring-boot:run + +## Using Camel components + +Apache Camel provides 200+ components which you can use to integrate and route messages between many systems +and data formats. To use any of these Camel components, add the component as a dependency to your project. + +## More information + +You can find more information about Apache Camel at the website: http://camel.apache.org/ http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAmqApplication.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAmqApplication.java b/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAmqApplication.java new file mode 100644 index 0000000..2442c2f --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAmqApplication.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.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +//CHECKSTYLE:OFF +@SpringBootApplication +@EnableAutoConfiguration +public class SampleAmqApplication { + + public static void main(String[] args) { + SpringApplication.run(SampleAmqApplication.class, args); + } +} +// CHECKSTYLE:ON http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java b/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java new file mode 100644 index 0000000..1afa083 --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java @@ -0,0 +1,35 @@ +/** + * 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.springframework.stereotype.Component; + +@Component +public class SampleAutowiredAmqRoute extends RouteBuilder { + + @Override + public void configure() throws Exception { + from("activemq:foo") + .to("log:sample"); + + from("timer:bar") + .setBody(constant("Hello from Camel")) + .to("activemq:foo"); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/src/main/resources/application.properties b/examples/camel-example-spring-boot-activemq/src/main/resources/application.properties new file mode 100644 index 0000000..497c52e --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/src/main/resources/application.properties @@ -0,0 +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. +## --------------------------------------------------------------------------- + +#You can use this property to override the default autowired broker-url +#spring.activemq.broker-url=tcp://localhost:61616 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java b/examples/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java new file mode 100644 index 0000000..e1534d8 --- /dev/null +++ b/examples/camel-example-spring-boot-activemq/src/test/java/sample/camel/SampleAmqApplicationTests.java @@ -0,0 +1,43 @@ +/** + * 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 java.util.concurrent.TimeUnit; + +import org.apache.camel.CamelContext; +import org.apache.camel.builder.NotifyBuilder; +import org.apache.camel.test.spring.CamelSpringBootRunner; +import org.junit.Ignore; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.junit.Assert.assertTrue; + +@RunWith(CamelSpringBootRunner.class) +@SpringBootTest(classes = SampleAmqApplication.class) +public class SampleAmqApplicationTests { + @Autowired + private CamelContext camelContext; + + @Ignore("Requires a running activemq broker") + public void shouldProduceMessages() throws Exception { + NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create(); + + assertTrue(notify.matches(10, TimeUnit.SECONDS)); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/pom.xml ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/pom.xml b/examples/camel-example-spring-boot-amq/pom.xml deleted file mode 100644 index 227b49b..0000000 --- a/examples/camel-example-spring-boot-amq/pom.xml +++ /dev/null @@ -1,131 +0,0 @@ -<?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</groupId> - <artifactId>examples</artifactId> - <version>2.20.0-SNAPSHOT</version> - </parent> - - <name>Camel :: Example :: Spring Boot</name> - <description>An example showing how to work with Camel, ActiveMq and Spring Boot</description> - - <properties> - <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</groupId> - <artifactId>camel-spring-boot-dependencies</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> - <!-- activemq --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-activemq</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> - </exclusion> - </exclusions> - </dependency> - <!-- Camel --> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring-boot-starter</artifactId> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-camel</artifactId> - <!-- version>5.14.0</version--> - <exclusions> - <exclusion> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> - </exclusion> - </exclusions> - </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> - <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> - - <profiles> - <profile> - <id>jdk9-build</id> - <activation> - <jdk>9</jdk> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <argLine>--add-modules java.xml.bind --add-opens - java.base/java.lang=ALL-UNNAMED</argLine> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - - - <artifactId>camel-example-spring-boot-amq</artifactId> -</project> http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/readme.adoc ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/readme.adoc b/examples/camel-example-spring-boot-amq/readme.adoc deleted file mode 100644 index c3634ad..0000000 --- a/examples/camel-example-spring-boot-amq/readme.adoc +++ /dev/null @@ -1,23 +0,0 @@ -# Camel Example Spring Boot and ActiveMQ - -This example shows how to work with a simple Apache Camel application using Spring Boot and Apache ActiveMQ starter - -##prerequisites -A running Apache ActiveMQ instance with openwire transportConnector opened on port 1234 - -The port is also configured in application.properties as spring.activemq.broker-url - -## Using Camel components - -Apache Camel provides 200+ components which you can use to integrate and route messages between many systems -and data formats. To use any of these Camel components, add the component as a dependency to your project. - -## How to run - -You can run this example using - - mvn spring-boot:run - -## More information - -You can find more information about Apache Camel at the website: http://camel.apache.org/ http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAmqApplication.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAmqApplication.java b/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAmqApplication.java deleted file mode 100644 index 2442c2f..0000000 --- a/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAmqApplication.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -//CHECKSTYLE:OFF -@SpringBootApplication -@EnableAutoConfiguration -public class SampleAmqApplication { - - public static void main(String[] args) { - SpringApplication.run(SampleAmqApplication.class, args); - } -} -// CHECKSTYLE:ON http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java b/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java deleted file mode 100644 index 5746a60..0000000 --- a/examples/camel-example-spring-boot-amq/src/main/java/sample/camel/SampleAutowiredAmqRoute.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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.springframework.stereotype.Component; - -@Component -public class SampleAutowiredAmqRoute extends RouteBuilder { - - @Override - public void configure() throws Exception { - from("activemq:foo") - .to("log:sample"); - - from("timer:bar") - .setBody(constant("hello from camel")) - .to("activemq:foo"); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/src/main/resources/application.properties b/examples/camel-example-spring-boot-amq/src/main/resources/application.properties deleted file mode 100644 index 6aafea1..0000000 --- a/examples/camel-example-spring-boot-amq/src/main/resources/application.properties +++ /dev/null @@ -1,17 +0,0 @@ -## --------------------------------------------------------------------------- -## 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.activemq.broker-url=tcp://localhost:1234 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/camel-example-spring-boot-amq/src/test/java/sample/camel/SampleAmqApplicationTests.java ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-amq/src/test/java/sample/camel/SampleAmqApplicationTests.java b/examples/camel-example-spring-boot-amq/src/test/java/sample/camel/SampleAmqApplicationTests.java deleted file mode 100644 index b5cd520..0000000 --- a/examples/camel-example-spring-boot-amq/src/test/java/sample/camel/SampleAmqApplicationTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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 java.util.concurrent.TimeUnit; - -import org.apache.camel.CamelContext; -import org.apache.camel.builder.NotifyBuilder; -import org.apache.camel.test.spring.CamelSpringBootRunner; -import org.junit.Ignore; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -import static org.junit.Assert.assertTrue; - -@RunWith(CamelSpringBootRunner.class) -@SpringBootTest(classes = SampleAmqApplication.class) -public class SampleAmqApplicationTests { - @Autowired - private CamelContext camelContext; - - @Ignore("Requires a running activemq with openwire port 1234") - public void shouldProduceMessages() throws Exception { - NotifyBuilder notify = new NotifyBuilder(camelContext).whenDone(1).create(); - - assertTrue(notify.matches(10, TimeUnit.SECONDS)); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/7162d79d/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index 9701d02..e207197 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -94,7 +94,7 @@ <module>camel-example-splunk</module> <module>camel-example-spring</module> <module>camel-example-spring-boot</module> - <module>camel-example-spring-boot-amq</module> + <module>camel-example-spring-boot-activemq</module> <module>camel-example-spring-boot-geocoder</module> <module>camel-example-spring-boot-live-reload</module> <module>camel-example-spring-boot-metrics</module>