You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/11/18 07:02:15 UTC
[camel] 01/02: added new example showing how to use amqp with
artemis.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit bf46a92b36d6a21cf32d153d7d9eac9a1d422af9
Author: Bruno Meseguer <br...@Brunos-MBP.home>
AuthorDate: Wed Nov 15 19:02:27 2017 +0000
added new example showing how to use amqp with artemis.
---
examples/README.adoc | 4 +-
.../camel-example-artemis-amqp-blueprint/README.md | 94 ++++++++++
.../camel-example-artemis-amqp-blueprint/pom.xml | 155 ++++++++++++++++
.../src/main/resources/META-INF/LICENSE.txt | 203 +++++++++++++++++++++
.../src/main/resources/META-INF/NOTICE.txt | 11 ++
.../resources/OSGI-INF/blueprint/camel-context.xml | 66 +++++++
.../src/main/resources/features.xml | 31 ++++
.../src/main/resources/log4j2.properties | 28 +++
.../example/artemis/amqp/ArtemisAmqpTest.java | 59 ++++++
.../artemis/amqp/EmbeddedBrokerSupport.java | 50 +++++
.../OSGI-INF/blueprint/embedded-broker.xml | 63 +++++++
.../src/test/resources/broker.xml | 49 +++++
examples/pom.xml | 1 +
13 files changed, 813 insertions(+), 1 deletion(-)
diff --git a/examples/README.adoc b/examples/README.adoc
index 6d281ee..73b5914 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: 99 (8 deprecated)
+Number of Examples: 100 (8 deprecated)
[width="100%",cols="4,2,4",options="header"]
|===
@@ -139,6 +139,8 @@ Number of Examples: 99 (8 deprecated)
| link:camel-example-activemq-tomcat/README.md[ActiveMQ Tomcat] (camel-example-activemq-tomcat) | Messaging | An example using ActiveMQ Broker and Camel with Apache Tomcat
+| link:camel-example-artemis-amqp-blueprint/README.md[Artemis Amqp Blueprint] (camel-example-artemis-amqp-blueprint) | Messaging | Demonstrates ActiveMQ Artemis using Camel's AMQP component. The example includes a JUnit showcasing how to embed for testing an AMQP enabled Artemis broker.
+
| link:camel-example-artemis-large-messages/README.md[Artemis Large Messages] (camel-example-artemis-large-messages) | Messaging | Demonstrates sending large messages (handles GBs in size) between Apache Camel and ActiveMQ Artemis in streaming mode
| link:camel-example-google-pubsub/README.adoc[Google Pubsub] (camel-example-google-pubsub) | Messaging | An example for Google Pubsub
diff --git a/examples/camel-example-artemis-amqp-blueprint/README.md b/examples/camel-example-artemis-amqp-blueprint/README.md
new file mode 100644
index 0000000..480863e
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/README.md
@@ -0,0 +1,94 @@
+# Camel Artemis AMQP Messaging
+
+### Introduction
+
+This example shows how to produce/consume messages between Apache Camel and ActiveMQ Artemis using the AMQP component based on the JMS 2.0 Apache Qpid Proton client library.
+
+One benefit of using Camel's AMQP component is to allow connectivity to Qpid's Dispatch Router enabling flexible and scalable interconnect between any AMQP endpoints.
+
+The example includes a JUnit to showcase how to embed an AMQP enabled Artemis Broker. This permits building and testing the code in complete isolation.
+
+When deployed in a running environment, Camel will attempt to connect to an already existing Artemis broker using the default AMQP port (5672).
+
+### Test with embedded Artemis
+
+The JUnit with an included embedded Artemis Broker can be triggered using Maven.
+
+ mvn test
+
+### Install ActiveMQ Artemis
+
+You download and unzip Apache ActiveMQ Artemis from: http://activemq.apache.org/artemis/download.html
+
+After unzipping the download, you can then create a new broker with the name `mybroker`:
+
+ $ cd apache-artemis-2.4.0
+ $ bin/artemis create mybroker
+
+### Run ActiveMQ Artemis
+
+You start ActiveMQ in a shell by running:
+
+ $ cd mybroker
+ $ bin/artemis run
+
+Which startup Artemis in the foreground and keeps it running until you hit <kbd>ctrl</kbd>+<kbd>c</kbd>
+to shutdown Artemis.
+
+### Run Camel
+
+Start the Camel application:
+
+ mvn camel:run -DskipTests=true
+
+Once started, Camel will be listening for HTTP requests (default port 8080) as a trigger mechanism to fire AMQP messages to Artemis.
+
+From your prefered browser hit the following URL:
+
+ http://localhost:8080/message
+
+Or alternatively, using cURL:
+
+ curl http://localhost:8080/message
+
+The above actions should render on screen:
+
+ Hello from Camel's AMQP example
+
+To stop the example hit <kbd>ctrl</kbd>+<kbd>c</kbd>.
+
+### ActiveMQ Artemis web console
+
+You can browse the Artemis web console: <http://localhost:8161/console>
+to see activity such as number of consumers and producers or acknoledged messages.
+
+### Run with Karaf
+You will need to install this example first to your local maven repository with:
+
+ mvn install
+
+Then you can install this example from the shell using this example's `features.xml`
+for easy provisioning:
+
+ feature:repo-add mvn:org.apache.camel.example/camel-example-artemis-amqp-blueprint/${version}/xml/features
+ feature:install camel-example-artemis-amqp-blueprint
+
+And you can see the application running by tailing the logs:
+
+ log:tail
+
+And you can use <kbd>ctrl</kbd>+<kbd>c</kbd> to stop tailing the log.
+
+### Forum, Help, etc
+
+If you hit an problems please let us know on the Camel Forums
+ <http://camel.apache.org/discussion-forums.html>
+
+Please help us make Apache Camel better - we appreciate any feedback you may
+have. Enjoy!
+
+
+
+The Camel riders!
+
+
diff --git a/examples/camel-example-artemis-amqp-blueprint/pom.xml b/examples/camel-example-artemis-amqp-blueprint/pom.xml
new file mode 100644
index 0000000..599771f
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/pom.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.camel.example</groupId>
+ <artifactId>examples</artifactId>
+ <version>2.21.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-example-artemis-amqp-blueprint</artifactId>
+ <packaging>bundle</packaging>
+ <name>Camel :: Example :: ActiveMQ Artemis AMQP :: Blueprint</name>
+ <description>Demonstrates ActiveMQ Artemis using Camel's AMQP component. The example includes a JUnit showcasing how to embed for testing an AMQP enabled Artemis broker.</description>
+
+ <properties>
+ <category>Messaging</category>
+ </properties>
+
+
+ <dependencies>
+
+ <!-- camel -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-blueprint</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-netty4-http</artifactId>
+ </dependency>
+
+ <!-- Embbeded Artemis AMQP JMS Broker -->
+ <!-- ATTENTION: Needs to be placed before Camel's AMQP component -->
+ <!-- Netty versions between both enter in conflict -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-server</artifactId>
+ <version>${activemq-artemis-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-jms-server</artifactId>
+ <version>${activemq-artemis-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>artemis-amqp-protocol</artifactId>
+ <version>${activemq-artemis-version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Camel's AMQP connectivity -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-amqp</artifactId>
+ </dependency>
+
+ <!-- Testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-blueprint</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Test Logging -->
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <!-- to generate the MANIFEST-FILE of the bundle -->
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ </plugin>
+
+ <!-- to run the example using mvn camel:run -->
+ <plugin>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-maven-plugin</artifactId>
+ <configuration>
+ <useBlueprint>true</useBlueprint>
+ </configuration>
+ </plugin>
+
+ <!-- to attach Features descritor for Karaf deployment -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/classes/features.xml</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+</project>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/LICENSE.txt b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/NOTICE.txt b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/main/resources/OSGI-INF/blueprint/camel-context.xml b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/OSGI-INF/blueprint/camel-context.xml
new file mode 100644
index 0000000..0f61b15
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/OSGI-INF/blueprint/camel-context.xml
@@ -0,0 +1,66 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+ http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
+ http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
+
+ <!-- blueprint property placeholders -->
+ <cm:property-placeholder persistent-id="my-placeholders" update-strategy="reload">
+ <cm:default-properties>
+ <cm:property name="netty.port" value="8080" />
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+
+ <!-- JMS QPid Proton Configuration -->
+ <bean id="jmsConnectionFactory" class="org.apache.qpid.jms.JmsConnectionFactory">
+ <property name="remoteURI" value="amqp://localhost:5672" />
+ </bean>
+
+ <!-- Camel AMQP Component configuration -->
+ <bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
+ <property name="connectionFactory" ref="jmsConnectionFactory" />
+ </bean>
+
+
+ <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
+
+ <!-- AMQP producer example (HTTP triggered) -->
+ <route id="amqp-producer">
+ <from uri="netty4-http:localhost:{{netty.port}}/message"/>
+ <log message="got Netty request, about to send AMQP message."/>
+ <to uri="amqp:queue:myqueue"/>
+ </route>
+
+ <!-- AMQP Consumer example -->
+ <route id="amqp-consumer">
+ <from uri="amqp:queue:myqueue"/>
+ <log message="got AMQP request, about to respond."/>
+ <setBody>
+ <simple>Hello from Camel's AMQP example</simple>
+ </setBody>
+ </route>
+
+ </camelContext>
+</blueprint>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/main/resources/features.xml b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/features.xml
new file mode 100644
index 0000000..61d64bf
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/features.xml
@@ -0,0 +1,31 @@
+<?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.
+
+-->
+<features>
+ <repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features</repository>
+
+ <feature name="${project.artifactId}" version="${project.version}">
+ <feature version="${project.version}">camel</feature>
+ <feature version="${project.version}">camel-blueprint</feature>
+ <feature version="${project.version}">camel-amqp</feature>
+ <feature version="${project.version}">camel-netty4-http</feature>
+ <bundle>mvn:org.apache.camel.example/${project.artifactId}/${project.version}</bundle>
+ </feature>
+
+</features>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/main/resources/log4j2.properties b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/log4j2.properties
new file mode 100644
index 0000000..56ee6f3
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/main/resources/log4j2.properties
@@ -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.
+## ---------------------------------------------------------------------------
+
+appender.out.type = Console
+appender.out.name = out
+appender.out.layout.type = PatternLayout
+appender.out.layout.pattern = [%30.30t] %-30.30c{1} %-5p %m%n
+rootLogger.level = INFO
+rootLogger.appenderRef.out.ref = out
+
+# turn on logging on camel-jms to see more activity
+# logger.jms.name = org.apache.camel.component.jms
+# logger.jms.level = TRACE
+
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/ArtemisAmqpTest.java b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/ArtemisAmqpTest.java
new file mode 100644
index 0000000..cb9bfc1
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/ArtemisAmqpTest.java
@@ -0,0 +1,59 @@
+/**
+ * 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.artemis.amqp;
+
+import java.util.Dictionary;
+
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ArtemisAmqpTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor()
+ {
+ return "/OSGI-INF/blueprint/camel-context.xml,"+
+
+ //We add the embedded Artemis Broker
+ "/OSGI-INF/blueprint/embedded-broker.xml";
+ }
+
+ @Override
+ protected String useOverridePropertiesWithConfigAdmin(Dictionary props)
+ {
+ //obtain an available port
+ int port = AvailablePortFinder.getNextAvailable();
+
+ //override the netty port to use
+ props.put("netty.port", ""+port);
+
+ //return the PID of the config-admin we are using in the blueprint xml file
+ return "my-placeholders";
+ }
+
+ @Test
+ public void testEmbeddedBroker() throws Exception
+ {
+ //trigger
+ String response = template.requestBody("netty4-http:localhost:{{netty.port}}/message", null, String.class);
+
+ //response validation
+ assertEquals("not expected", "Hello from Camel's AMQP example", response);
+ }
+}
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.java
new file mode 100644
index 0000000..1a491fa
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/java/org/apache/camel/example/artemis/amqp/EmbeddedBrokerSupport.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 org.apache.camel.example.artemis.amqp;
+
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager;
+// import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+// import org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule;
+
+
+//#################################################
+// Blueprint does not support Bean inheritance (necessary for Artemis EmbeddedJMS)
+// We need therefore a 'support' class
+//#################################################
+public class EmbeddedBrokerSupport extends EmbeddedJMS
+{
+ public EmbeddedBrokerSupport(ActiveMQJAASSecurityManager securityManager) throws Exception
+ {
+ super();
+ this.setSecurityManager(securityManager);
+ this.start();
+
+ //if you need more twicking use Java to customise as follows:
+ // SecurityConfiguration securityConfig = new SecurityConfiguration();
+ // securityConfig.addUser("guest", "guest");
+ // securityConfig.addRole("guest", "guest");
+ // securityConfig.setDefaultUser("guest");
+ // ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), securityConfig);
+ // this.setSecurityManager(securityManager);
+ }
+
+ public void close() throws Exception
+ {
+ this.stop();
+ }
+}
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml
new file mode 100644
index 0000000..0cc179e
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/OSGI-INF/blueprint/embedded-broker.xml
@@ -0,0 +1,63 @@
+<?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.
+
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
+ xsi:schemaLocation="
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
+ http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
+ http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd">
+
+
+ <!-- Security Manager with default user -->
+ <bean id="securityManager" class="org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager">
+ <argument value="org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule"/>
+ <argument>
+ <bean class="org.apache.activemq.artemis.core.config.impl.SecurityConfiguration">
+ <argument>
+ <map>
+ <entry key="guest" value="guest"/>
+ </map>
+ </argument>
+ <argument>
+ <map>
+ <entry key="guest">
+ <list>
+ <value>guest</value>
+ </list>
+ </entry>
+ </map>
+ </argument>
+ <property name="defaultUser" value="guest"/>
+ </bean>
+ </argument>
+ </bean>
+
+ <!-- Blueprint does not support Bean inheritance (necessary for Artemis EmbeddedJMS)
+ We need therefore a 'support' class -->
+ <bean id="embeddedJMS"
+ class="org.apache.camel.example.artemis.amqp.EmbeddedBrokerSupport"
+ destroy-method="close">
+ <argument ref="securityManager"/>
+ </bean>
+
+
+
+</blueprint>
diff --git a/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml
new file mode 100644
index 0000000..4bacf5f
--- /dev/null
+++ b/examples/camel-example-artemis-amqp-blueprint/src/test/resources/broker.xml
@@ -0,0 +1,49 @@
+<?xml version='1.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.
+-->
+
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:activemq"
+ xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
+
+ <core xmlns="urn:activemq:core">
+
+ <persistence-enabled>false</persistence-enabled>
+
+
+ <acceptors>
+ <!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
+ <acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpMinCredits=300</acceptor>
+ </acceptors>
+
+
+ <security-settings>
+ <!--security for example queue-->
+ <security-setting match="#">
+ <permission type="createDurableQueue" roles="guest"/>
+ <permission type="deleteDurableQueue" roles="guest"/>
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+ </core>
+</configuration>
\ No newline at end of file
diff --git a/examples/pom.xml b/examples/pom.xml
index 3b406c4..e4558eb 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -37,6 +37,7 @@
<modules>
<module>camel-example-activemq-tomcat</module>
<module>camel-example-aggregate</module>
+ <module>camel-example-artemis-amqp-blueprint</module>
<module>camel-example-artemis-large-messages</module>
<module>camel-example-bam</module>
<module>camel-example-cafe</module>
--
To stop receiving notification emails like this one, please contact
"commits@camel.apache.org" <co...@camel.apache.org>.