Skip to content

Commit

Permalink
Add ActiveMQ extension
Browse files Browse the repository at this point in the history
Fixes #424
  • Loading branch information
jamesnetherton committed Mar 9, 2020
1 parent a975932 commit 17eb6d1
Show file tree
Hide file tree
Showing 18 changed files with 825 additions and 14 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ jobs:
-Dnative \
-Ddocker \
-DskipTests \
-pl :camel-quarkus-integration-test-activemq \
-pl :camel-quarkus-integration-test-kafka \
-pl :camel-quarkus-integration-test-messaging
dataformats:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ In case you are missing some Camel feature in the list:
== Camel Components

// components: START
Number of Camel components: 71 in 61 JAR artifacts (0 deprecated)
Number of Camel components: 72 in 62 JAR artifacts (0 deprecated)

[width="100%",cols="4,1,5",options="header"]
|===
| Component | Since | Description

| link:https://camel.apache.org/components/latest/activemq-component.html[ActiveMQ] (camel-quarkus-activemq) +
`activemq:destinationType:destinationName` | 1.0.0-M5 | The activemq component allows messages to be sent to (or consumed from) Apache ActiveMQ. This component extends the Camel JMS component.

| xref:extensions/ahc.adoc[AHC] (camel-quarkus-ahc) +
`ahc:httpUri` | 1.0.0-M3 | To call external HTTP services using Async Http Client.

Expand Down
86 changes: 86 additions & 0 deletions extensions/activemq/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?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-activemq-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-activemq-deployment</artifactId>
<name>Camel Quarkus :: ActiveMQ :: 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-jms-deployment</artifactId>
<!-- ActiveMQ is bound to JMS 1.1 -->
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-activemq</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* 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.activemq.deployment;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class ActiveMQProcessor {

private static final String ACTIVEMQ_SERVICE_BASE = "META-INF/services/org/apache/activemq/";
private static final String FEATURE = "camel-activemq";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
return new ExtensionSslNativeSupportBuildItem(FEATURE);
}

@BuildStep
ReflectiveClassBuildItem registerForReflection() {
return new ReflectiveClassBuildItem(true, false,
"org.apache.activemq.pool.PooledConnectionFactory",
"org.apache.commons.pool2.impl.DefaultEvictionPolicy",
"org.apache.activemq.openwire.v2.MarshallerFactory",
"org.apache.activemq.openwire.v3.MarshallerFactory",
"org.apache.activemq.openwire.v4.MarshallerFactory",
"org.apache.activemq.openwire.v5.MarshallerFactory",
"org.apache.activemq.openwire.v6.MarshallerFactory",
"org.apache.activemq.openwire.v7.MarshallerFactory",
"org.apache.activemq.openwire.v8.MarshallerFactory",
"org.apache.activemq.openwire.v9.MarshallerFactory",
"org.apache.activemq.openwire.v10.MarshallerFactory",
"org.apache.activemq.openwire.v11.MarshallerFactory",
"org.apache.activemq.openwire.v12.MarshallerFactory");
}

@BuildStep
void registerServiceProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<NativeImageResourceBuildItem> nativeImage) {

String[] servicePaths = new String[] {
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/masterslave",
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/multicast",
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/simple",
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/static",
ACTIVEMQ_SERVICE_BASE + "transport/failover",
ACTIVEMQ_SERVICE_BASE + "transport/fanout",
ACTIVEMQ_SERVICE_BASE + "transport/mock",
ACTIVEMQ_SERVICE_BASE + "transport/multicast",
ACTIVEMQ_SERVICE_BASE + "transport/nio",
ACTIVEMQ_SERVICE_BASE + "transport/nio+ssl",
ACTIVEMQ_SERVICE_BASE + "transport/ssl",
ACTIVEMQ_SERVICE_BASE + "transport/tcp",
ACTIVEMQ_SERVICE_BASE + "transport/udp",
ACTIVEMQ_SERVICE_BASE + "wireformat/default",
};

for (String path : servicePaths) {
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, getServiceClass(path)));
}

nativeImage.produce(new NativeImageResourceBuildItem(servicePaths));
}

private String getServiceClass(String servicePath) {
try (InputStream resource = ActiveMQProcessor.class.getClassLoader().getResourceAsStream(servicePath)) {
Properties properties = new Properties();
properties.load(resource);
return properties.getProperty("class");
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
}
50 changes: 50 additions & 0 deletions extensions/activemq/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?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>1.1.0-SNAPSHOT</version>
<relativePath>../../poms/build-parent/pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-activemq-parent</artifactId>
<name>Camel Quarkus :: ActiveMQ</name>
<packaging>pom</packaging>

<modules>
<module>deployment</module>
<module>runtime</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom-deployment</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
97 changes: 97 additions & 0 deletions extensions/activemq/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?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-activemq-parent</artifactId>
<version>1.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>camel-quarkus-activemq</artifactId>
<name>Camel Quarkus :: ActiveMQ :: Runtime</name>

<properties>
<firstVersion>1.0.0-M5</firstVersion>
</properties>

<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.quarkus</groupId>
<artifactId>camel-quarkus-jms</artifactId>
<!-- ActiveMQ is bound to JMS 1.1 -->
<exclusions>
<exclusion>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_2.0_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>svm</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>

0 comments on commit 17eb6d1

Please sign in to comment.