Skip to content

Commit e2b57d6

Browse files
committed
Add ActiveMQ 6 extension
1 parent 37aa3bb commit e2b57d6

File tree

25 files changed

+973
-0
lines changed

25 files changed

+973
-0
lines changed

catalog/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@
9797
</exclusion>
9898
</exclusions>
9999
</dependency>
100+
<dependency>
101+
<groupId>org.apache.camel.quarkus</groupId>
102+
<artifactId>camel-quarkus-activemq6</artifactId>
103+
<version>${project.version}</version>
104+
<type>pom</type>
105+
<scope>test</scope>
106+
<exclusions>
107+
<exclusion>
108+
<groupId>*</groupId>
109+
<artifactId>*</artifactId>
110+
</exclusion>
111+
</exclusions>
112+
</dependency>
100113
<dependency>
101114
<groupId>org.apache.camel.quarkus</groupId>
102115
<artifactId>camel-quarkus-amqp</artifactId>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Do not edit directly!
2+
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
3+
cqArtifactId: camel-quarkus-activemq6
4+
cqArtifactIdBase: activemq6
5+
cqNativeSupported: true
6+
cqStatus: Stable
7+
cqDeprecated: false
8+
cqJvmSince: 3.30.0
9+
cqNativeSince: 3.30.0
10+
cqCamelPartName: activemq6
11+
cqCamelPartTitle: ActiveMQ 6.x
12+
cqCamelPartDescription: Send messages to (or consume from) Apache ActiveMQ 6.x. This component extends the Camel JMS component.
13+
cqExtensionPageTitle: ActiveMQ 6.x

docs/modules/ROOT/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
*** xref:reference/extensions/aws-secrets-manager.adoc[AWS Secrets Manager]
5555
*** xref:reference/extensions/aws-xray.adoc[AWS XRay]
5656
*** xref:reference/extensions/activemq.adoc[ActiveMQ]
57+
*** xref:reference/extensions/activemq6.adoc[ActiveMQ 6.x]
5758
*** xref:reference/extensions/arangodb.adoc[ArangoDb]
5859
*** xref:reference/extensions/asterisk.adoc[Asterisk]
5960
*** xref:reference/extensions/atom.adoc[Atom]
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// Do not edit directly!
2+
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
3+
[id="extensions-activemq6"]
4+
= ActiveMQ 6.x
5+
:linkattrs:
6+
:cq-artifact-id: camel-quarkus-activemq6
7+
:cq-native-supported: true
8+
:cq-status: Stable
9+
:cq-status-deprecation: Stable
10+
:cq-description: Send messages to (or consume from) Apache ActiveMQ 6.x. This component extends the Camel JMS component.
11+
:cq-deprecated: false
12+
:cq-jvm-since: 3.30.0
13+
:cq-native-since: 3.30.0
14+
15+
ifeval::[{doc-show-badges} == true]
16+
[.badges]
17+
[.badge-key]##JVM since##[.badge-supported]##3.30.0## [.badge-key]##Native since##[.badge-supported]##3.30.0##
18+
endif::[]
19+
20+
Send messages to (or consume from) Apache ActiveMQ 6.x. This component extends the Camel JMS component.
21+
22+
[id="extensions-activemq6-whats-inside"]
23+
== What's inside
24+
25+
* xref:{cq-camel-components}::activemq6-component.adoc[ActiveMQ 6.x component], URI syntax: `activemq6:destinationType:destinationName`
26+
27+
Please refer to the above link for usage and configuration details.
28+
29+
[id="extensions-activemq6-maven-coordinates"]
30+
== Maven coordinates
31+
32+
https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-activemq6[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]
33+
34+
Or add the coordinates to your existing project:
35+
36+
[source,xml]
37+
----
38+
<dependency>
39+
<groupId>org.apache.camel.quarkus</groupId>
40+
<artifactId>camel-quarkus-activemq6</artifactId>
41+
</dependency>
42+
----
43+
ifeval::[{doc-show-user-guide-link} == true]
44+
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
45+
endif::[]
46+
47+
[id="extensions-activemq6-usage"]
48+
== Usage
49+
[id="extensions-activemq6-usage-message-mapping-with-org-w3c-dom-node"]
50+
=== Message mapping with `org.w3c.dom.Node`
51+
52+
The Camel ActiveMQ component supports message mapping between `jakarta.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`,
53+
you must ensure that the `camel-quarkus-xml-jaxp` extension is present on the classpath.
54+
55+
[id="extensions-activemq6-usage-native-mode-support-for-jakarta-jms-objectmessage"]
56+
=== Native mode support for jakarta.jms.ObjectMessage
57+
58+
When sending JMS message payloads as `jakarta.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`.
59+
Note that this extension automatically sets `quarkus.camel.native.reflection.serialization-enabled = true` for you. Refer to the xref:user-guide/native-mode.adoc#serialization[native mode user guide] for more information.
60+
61+
62+
[id="extensions-activemq6-camel-quarkus-limitations"]
63+
== Camel Quarkus limitations
64+
65+
ActiveMQ https://activemq.apache.org/selectors.html[XPath selectors] are disabled in native mode as the functionality depends on `activemq-broker`. This dependency
66+
is excluded from the dependency tree, since none of the ActiveMQ broker functionality is supported in native mode.
67+
68+
69+
[id="extensions-activemq6-ssl-in-native-mode"]
70+
== SSL in native mode
71+
72+
This extension auto-enables SSL support in native mode. Hence you do not need to add
73+
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
74+
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
75+
76+
[id="extensions-activemq6-transferexception-option-in-native-mode"]
77+
== transferException option in native mode
78+
79+
To use the `transferException` option in native mode, you must enable support for object serialization. Refer to the xref:user-guide/native-mode.adoc#serialization[native mode user guide]
80+
for more information.
81+
82+
You will also need to enable serialization for the exception classes that you intend to serialize. For example.
83+
[source,java]
84+
----
85+
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
86+
----
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one or more
5+
contributor license agreements. See the NOTICE file distributed with
6+
this work for additional information regarding copyright ownership.
7+
The ASF licenses this file to You under the Apache License, Version 2.0
8+
(the "License"); you may not use this file except in compliance with
9+
the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
<parent>
25+
<groupId>org.apache.camel.quarkus</groupId>
26+
<artifactId>camel-quarkus-activemq6-parent</artifactId>
27+
<version>3.30.0-SNAPSHOT</version>
28+
<relativePath>../pom.xml</relativePath>
29+
</parent>
30+
31+
<artifactId>camel-quarkus-activemq6-deployment</artifactId>
32+
<name>Camel Quarkus :: ActiveMQ 6.x :: Deployment</name>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.apache.camel.quarkus</groupId>
37+
<artifactId>camel-quarkus-core-deployment</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>org.apache.camel.quarkus</groupId>
41+
<artifactId>camel-quarkus-jms-deployment</artifactId>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.camel.quarkus</groupId>
45+
<artifactId>camel-quarkus-activemq6</artifactId>
46+
</dependency>
47+
</dependencies>
48+
49+
<build>
50+
<plugins>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-compiler-plugin</artifactId>
54+
<configuration>
55+
<annotationProcessorPaths>
56+
<path>
57+
<groupId>io.quarkus</groupId>
58+
<artifactId>quarkus-extension-processor</artifactId>
59+
<version>${quarkus.version}</version>
60+
</path>
61+
</annotationProcessorPaths>
62+
</configuration>
63+
</plugin>
64+
</plugins>
65+
</build>
66+
67+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.camel.quarkus.component.activemq6.deployment;
18+
19+
import java.io.IOException;
20+
import java.io.InputStream;
21+
import java.util.Collection;
22+
import java.util.Properties;
23+
import java.util.stream.Stream;
24+
25+
import io.quarkus.deployment.annotations.BuildProducer;
26+
import io.quarkus.deployment.annotations.BuildStep;
27+
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
28+
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
29+
import io.quarkus.deployment.builditem.FeatureBuildItem;
30+
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
31+
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
32+
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
33+
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
34+
import org.apache.activemq.transport.Transport;
35+
import org.apache.activemq.transport.discovery.DiscoveryAgent;
36+
import org.apache.activemq.util.IdGenerator;
37+
import org.apache.activemq.wireformat.WireFormatFactory;
38+
import org.jboss.jandex.ClassInfo;
39+
import org.jboss.jandex.DotName;
40+
import org.jboss.jandex.IndexView;
41+
42+
class ActiveMQ6Processor {
43+
44+
private static final String ACTIVEMQ_SERVICE_BASE = "META-INF/services/org/apache/activemq/";
45+
private static final String FEATURE = "camel-activemq6";
46+
47+
@BuildStep
48+
FeatureBuildItem feature() {
49+
return new FeatureBuildItem(FEATURE);
50+
}
51+
52+
@BuildStep
53+
ExtensionSslNativeSupportBuildItem activateSslNativeSupport() {
54+
return new ExtensionSslNativeSupportBuildItem(FEATURE);
55+
}
56+
57+
@BuildStep
58+
void reflectiveClasses(
59+
CombinedIndexBuildItem combinedIndex,
60+
BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
61+
62+
reflectiveClasses.produce(
63+
ReflectiveClassBuildItem.builder(
64+
java.net.Socket.class.getName(),
65+
"sun.security.ssl.SSLSocketImpl",
66+
org.apache.activemq.ActiveMQConnectionFactory.class.getName(),
67+
org.apache.activemq.ActiveMQPrefetchPolicy.class.getName(),
68+
org.apache.activemq.RedeliveryPolicy.class.getName(),
69+
org.apache.activemq.blob.BlobTransferPolicy.class.getName(),
70+
org.apache.activemq.command.ConsumerInfo.class.getName(),
71+
org.apache.activemq.openwire.v9.MarshallerFactory.class.getName(),
72+
org.apache.activemq.openwire.v10.MarshallerFactory.class.getName(),
73+
org.apache.activemq.openwire.v11.MarshallerFactory.class.getName(),
74+
org.apache.activemq.openwire.v12.MarshallerFactory.class.getName())
75+
.methods()
76+
.build());
77+
78+
final IndexView index = combinedIndex.getIndex();
79+
80+
reflectiveClasses.produce(
81+
ReflectiveClassBuildItem.builder(
82+
Stream.of(Transport.class, WireFormatFactory.class, DiscoveryAgent.class)
83+
.map(DotName::createSimple)
84+
.map(index::getAllKnownImplementations)
85+
.flatMap(Collection::stream)
86+
.map(ClassInfo::name)
87+
.map(DotName::toString)
88+
.toArray(String[]::new))
89+
.methods()
90+
.build());
91+
}
92+
93+
@BuildStep
94+
void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) {
95+
indexDependency.produce(new IndexDependencyBuildItem("org.apache.activemq", "activemq-client"));
96+
}
97+
98+
@BuildStep
99+
void registerServiceProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
100+
BuildProducer<NativeImageResourceBuildItem> nativeImage) {
101+
102+
String[] servicePaths = new String[] {
103+
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/masterslave",
104+
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/multicast",
105+
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/simple",
106+
ACTIVEMQ_SERVICE_BASE + "transport/discoveryagent/static",
107+
ACTIVEMQ_SERVICE_BASE + "transport/failover",
108+
ACTIVEMQ_SERVICE_BASE + "transport/fanout",
109+
ACTIVEMQ_SERVICE_BASE + "transport/mock",
110+
ACTIVEMQ_SERVICE_BASE + "transport/multicast",
111+
ACTIVEMQ_SERVICE_BASE + "transport/nio",
112+
ACTIVEMQ_SERVICE_BASE + "transport/nio+ssl",
113+
ACTIVEMQ_SERVICE_BASE + "transport/ssl",
114+
ACTIVEMQ_SERVICE_BASE + "transport/tcp",
115+
ACTIVEMQ_SERVICE_BASE + "transport/udp",
116+
ACTIVEMQ_SERVICE_BASE + "wireformat/default",
117+
};
118+
119+
for (String path : servicePaths) {
120+
reflectiveClass.produce(ReflectiveClassBuildItem.builder(getServiceClass(path)).methods().build());
121+
}
122+
123+
nativeImage.produce(new NativeImageResourceBuildItem(servicePaths));
124+
}
125+
126+
@BuildStep
127+
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClass) {
128+
runtimeInitializedClass.produce(new RuntimeInitializedClassBuildItem(IdGenerator.class.getName()));
129+
}
130+
131+
private String getServiceClass(String servicePath) {
132+
try (InputStream resource = ActiveMQ6Processor.class.getClassLoader().getResourceAsStream(servicePath)) {
133+
Properties properties = new Properties();
134+
properties.load(resource);
135+
return properties.getProperty("class");
136+
} catch (IOException e) {
137+
throw new IllegalStateException(e);
138+
}
139+
}
140+
141+
}

extensions/activemq6/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one or more
5+
contributor license agreements. See the NOTICE file distributed with
6+
this work for additional information regarding copyright ownership.
7+
The ASF licenses this file to You under the Apache License, Version 2.0
8+
(the "License"); you may not use this file except in compliance with
9+
the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
<project xmlns="http://maven.apache.org/POM/4.0.0"
21+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
<parent>
25+
<groupId>org.apache.camel.quarkus</groupId>
26+
<artifactId>camel-quarkus-extensions</artifactId>
27+
<version>3.30.0-SNAPSHOT</version>
28+
<relativePath>../pom.xml</relativePath>
29+
</parent>
30+
31+
<artifactId>camel-quarkus-activemq6-parent</artifactId>
32+
<name>Camel Quarkus :: ActiveMQ 6.x</name>
33+
<packaging>pom</packaging>
34+
35+
<modules>
36+
<module>deployment</module>
37+
<module>runtime</module>
38+
</modules>
39+
</project>

0 commit comments

Comments
 (0)