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 2019/09/11 05:14:30 UTC
[camel-quarkus] branch master updated: Add the camel-paho extension
to support the MQTT
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-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new bf85661 Add the camel-paho extension to support the MQTT
new 0153c54 Merge pull request #197 from zhfeng/camel-paho-support
bf85661 is described below
commit bf856616cf18c2ddb81286e13f9118d037f91021
Author: Amos Feng <zf...@redhat.com>
AuthorDate: Mon Sep 9 09:11:53 2019 +0800
Add the camel-paho extension to support the MQTT
---
.../ROOT/pages/_partials/component-extensions.adoc | 1 +
extensions/paho/deployment/pom.xml | 75 ++++++++++
.../component/paho/deployment/PahoProcessor.java | 70 ++++++++++
extensions/paho/pom.xml | 39 ++++++
extensions/paho/runtime/pom.xml | 78 +++++++++++
extensions/pom.xml | 1 +
integration-tests/paho/pom.xml | 151 +++++++++++++++++++++
.../quarkus/component/paho/it/PahoResource.java | 49 +++++++
.../component/paho/it/PahoRouteBuilder.java | 27 ++++
.../component/paho/it/ActiveMQTestResource.java | 57 ++++++++
.../camel/quarkus/component/paho/it/PahoIT.java | 24 ++++
.../camel/quarkus/component/paho/it/PahoTest.java | 41 ++++++
integration-tests/pom.xml | 18 ++-
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
15 files changed, 645 insertions(+), 1 deletion(-)
diff --git a/docs/modules/ROOT/pages/_partials/component-extensions.adoc b/docs/modules/ROOT/pages/_partials/component-extensions.adoc
index ea28021..43f8cae 100644
--- a/docs/modules/ROOT/pages/_partials/component-extensions.adoc
+++ b/docs/modules/ROOT/pages/_partials/component-extensions.adoc
@@ -12,6 +12,7 @@
* `camel-quarkus-mail`
* `camel-quarkus-microprofile-metrics`
* `camel-quarkus-netty-http`
+* `camel-quarkus-paho`
* `camel-quarkus-rest`
* `camel-quarkus-salesforce`
* `camel-quarkus-servlet`
diff --git a/extensions/paho/deployment/pom.xml b/extensions/paho/deployment/pom.xml
new file mode 100644
index 0000000..3041613
--- /dev/null
+++ b/extensions/paho/deployment/pom.xml
@@ -0,0 +1,75 @@
+<?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.quarkus</groupId>
+ <artifactId>camel-quarkus-paho-parent</artifactId>
+ <version>0.1.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-paho-deployment</artifactId>
+ <name>Camel Quarkus :: Paho :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-paho</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java b/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java
new file mode 100644
index 0000000..14af793
--- /dev/null
+++ b/extensions/paho/deployment/src/main/java/org/apache/camel/quarkus/component/paho/deployment/PahoProcessor.java
@@ -0,0 +1,70 @@
+/*
+ * 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.quarkus.component.paho.deployment;
+
+import io.quarkus.deployment.annotations.BuildProducer;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.substrate.SubstrateResourceBuildItem;
+import io.quarkus.deployment.builditem.substrate.SubstrateResourceBundleBuildItem;
+import org.eclipse.paho.client.mqttv3.internal.SSLNetworkModuleFactory;
+import org.eclipse.paho.client.mqttv3.internal.TCPNetworkModuleFactory;
+import org.eclipse.paho.client.mqttv3.logging.JSR47Logger;
+import org.eclipse.paho.client.mqttv3.spi.NetworkModuleFactory;
+
+import javax.inject.Inject;
+import java.util.Arrays;
+import java.util.List;
+
+class PahoProcessor {
+
+ private static final String FEATURE = "camel-paho";
+
+ @Inject
+ BuildProducer<SubstrateResourceBuildItem> resource;
+
+ @Inject
+ BuildProducer<SubstrateResourceBundleBuildItem> resourceBundle;
+
+ private static final List<Class<?>> PAHO_REFLECTIVE_CLASSES = Arrays.asList(
+ JSR47Logger.class,
+ TCPNetworkModuleFactory.class,
+ SSLNetworkModuleFactory.class
+ );
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
+ for (Class<?> type : PAHO_REFLECTIVE_CLASSES) {
+ reflectiveClass.produce(
+ new ReflectiveClassBuildItem(true, true, type)
+ );
+ }
+ }
+
+ @BuildStep
+ void registerBundleResource() {
+ resource.produce(new SubstrateResourceBuildItem("META-INF/services/" + NetworkModuleFactory.class.getName()));
+ resourceBundle.produce(new SubstrateResourceBundleBuildItem("org.eclipse.paho.client.mqttv3.internal.nls.logcat"));
+ }
+
+}
diff --git a/extensions/paho/pom.xml b/extensions/paho/pom.xml
new file mode 100644
index 0000000..d3dae6e
--- /dev/null
+++ b/extensions/paho/pom.xml
@@ -0,0 +1,39 @@
+<?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.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
+ <version>0.1.1-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-paho-parent</artifactId>
+ <name>Camel Quarkus :: Paho</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/paho/runtime/pom.xml b/extensions/paho/runtime/pom.xml
new file mode 100644
index 0000000..9dc9ad1
--- /dev/null
+++ b/extensions/paho/runtime/pom.xml
@@ -0,0 +1,78 @@
+<?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.quarkus</groupId>
+ <artifactId>camel-quarkus-paho-parent</artifactId>
+ <version>0.1.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-paho</artifactId>
+ <name>Camel Quarkus :: Paho :: Runtime</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-paho</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions/pom.xml b/extensions/pom.xml
index c1d3bc0..883f6a1 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -60,6 +60,7 @@
<module>zipfile</module>
<module>csv</module>
<module>microprofile-metrics</module>
+ <module>paho</module>
</modules>
<build>
diff --git a/integration-tests/paho/pom.xml b/integration-tests/paho/pom.xml
new file mode 100644
index 0000000..70621ac
--- /dev/null
+++ b/integration-tests/paho/pom.xml
@@ -0,0 +1,151 @@
+<?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.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>0.1.1-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-paho</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Paho</name>
+ <description>Integration tests for Camel Quarkus Paho extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-paho</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-log</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-mqtt</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native-image</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <systemProperties>
+ <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>native-image</id>
+ <goals>
+ <goal>native-image</goal>
+ </goals>
+ <configuration>
+ <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+ <cleanupServer>true</cleanupServer>
+ <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+ <enableServer>false</enableServer>
+ <dumpProxies>false</dumpProxies>
+ <graalvmHome>${graalvmHome}</graalvmHome>
+ <enableJni>true</enableJni>
+ <enableAllSecurityServices>true</enableAllSecurityServices>
+ <disableReports>true</disableReports>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java
new file mode 100644
index 0000000..89324b1
--- /dev/null
+++ b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoResource.java
@@ -0,0 +1,49 @@
+/*
+ * 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.quarkus.component.paho.it;
+
+import org.apache.camel.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+@Path("/paho")
+@ApplicationScoped
+public class PahoResource {
+
+ private static final Logger LOG = Logger.getLogger(PahoResource.class);
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/publish")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.TEXT_PLAIN)
+ public String post(String message) throws Exception {
+ LOG.infof("Sending to paho: %s", message);
+ final String response = producerTemplate.requestBody("direct:paho", message, String.class);
+ LOG.infof("Got response from paho: %s", response);
+ return response;
+ }
+}
diff --git a/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoRouteBuilder.java b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoRouteBuilder.java
new file mode 100644
index 0000000..6e99ac9
--- /dev/null
+++ b/integration-tests/paho/src/main/java/org/apache/camel/quarkus/component/paho/it/PahoRouteBuilder.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.paho.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class PahoRouteBuilder extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("direct:paho").to("paho:test/queue?autoReconnect=true");
+ from("paho:test/queue").transform(body().convertToString()).to("log:paho?showAll=true");
+ }
+}
diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java
new file mode 100644
index 0000000..0dd6ac0
--- /dev/null
+++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/ActiveMQTestResource.java
@@ -0,0 +1,57 @@
+/*
+ * 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.quarkus.component.paho.it;
+
+import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+
+import java.net.URI;
+import java.util.Collections;
+import java.util.Map;
+
+public class ActiveMQTestResource implements QuarkusTestResourceLifecycleManager {
+ private BrokerService broker;
+
+ @Override
+ public Map<String, String> start() {
+ try {
+ broker = new BrokerService();
+ TransportConnector mqtt = new TransportConnector();
+ mqtt.setUri(new URI("mqtt://127.0.0.1:1883"));
+ broker.addConnector(mqtt);
+ broker.setDataDirectory("target");
+ broker.start();
+ } catch (Exception e) {
+
+ }
+ return Collections.emptyMap();
+ }
+
+ @Override
+ public void stop() {
+ try {
+ if (broker != null) {
+ broker.stop();
+ }
+ } catch (Exception e) {
+
+ }
+ }
+}
+
diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java
new file mode 100644
index 0000000..cd6eb49
--- /dev/null
+++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.paho.it;
+
+import io.quarkus.test.junit.SubstrateTest;
+
+@SubstrateTest
+class PahoIT extends PahoTest {
+
+}
diff --git a/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
new file mode 100644
index 0000000..b7c83b6
--- /dev/null
+++ b/integration-tests/paho/src/test/java/org/apache/camel/quarkus/component/paho/it/PahoTest.java
@@ -0,0 +1,41 @@
+/*
+ * 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.quarkus.component.paho.it;
+
+import java.util.UUID;
+
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+@QuarkusTestResource(ActiveMQTestResource.class)
+class PahoTest {
+
+ @Test
+ public void test() {
+ final String msg = UUID.randomUUID().toString().replace("-", "");
+ RestAssured.given() //
+ .contentType(ContentType.TEXT).body(msg).post("/paho/publish") //
+ .then().statusCode(200);
+ }
+
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 994e945..947233a 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -41,8 +41,8 @@
-->
<native-image.docker-build>true</native-image.docker-build>
<native-image.container-runtime>docker</native-image.container-runtime>
-
<mock-javamail-version>1.9</mock-javamail-version>
+ <activemq-version>5.15.9</activemq-version>
</properties>
<dependencyManagement>
@@ -70,6 +70,21 @@
<artifactId>quarkus-core-deployment</artifactId>
<version>${quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-kahadb-store</artifactId>
+ <version>${activemq-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-mqtt</artifactId>
+ <version>${activemq-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-broker</artifactId>
+ <version>${activemq-version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -91,6 +106,7 @@
<module>twitter</module>
<module>zipfile</module>
<module>microprofile-metrics</module>
+ <module>paho</module>
</modules>
<build>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 4567ca6..90f6b63 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -189,6 +189,11 @@
<artifactId>camel-quarkus-zipfile-deployment</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-paho-deployment</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index e6c1c44..fc57b5d 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -172,6 +172,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-paho</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-rest</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -341,6 +346,11 @@
<artifactId>xstream</artifactId>
<version>${xstream.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-paho</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>