-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-add activemq extension after it was added back in Camel
4.0.0-RC1 fix #5087
- Loading branch information
Showing
24 changed files
with
1,017 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Do not edit directly! | ||
# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
cqArtifactId: camel-quarkus-activemq | ||
cqArtifactIdBase: activemq | ||
cqNativeSupported: true | ||
cqStatus: Stable | ||
cqDeprecated: false | ||
cqJvmSince: 1.0.0 | ||
cqNativeSince: 1.0.0 | ||
cqCamelPartName: activemq | ||
cqCamelPartTitle: ActiveMQ | ||
cqCamelPartDescription: Send messages to (or consume from) Apache ActiveMQ. This component extends the Camel JMS component. | ||
cqExtensionPageTitle: ActiveMQ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
docs/modules/ROOT/pages/reference/extensions/activemq.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Do not edit directly! | ||
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page | ||
[id="extensions-activemq"] | ||
= ActiveMQ | ||
:page-aliases: extensions/activemq.adoc | ||
:linkattrs: | ||
:cq-artifact-id: camel-quarkus-activemq | ||
:cq-native-supported: true | ||
:cq-status: Stable | ||
:cq-status-deprecation: Stable | ||
:cq-description: Send messages to (or consume from) Apache ActiveMQ. This component extends the Camel JMS component. | ||
:cq-deprecated: false | ||
:cq-jvm-since: 1.0.0 | ||
:cq-native-since: 1.0.0 | ||
|
||
ifeval::[{doc-show-badges} == true] | ||
[.badges] | ||
[.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0## | ||
endif::[] | ||
|
||
Send messages to (or consume from) Apache ActiveMQ. This component extends the Camel JMS component. | ||
|
||
[id="extensions-activemq-whats-inside"] | ||
== What's inside | ||
|
||
* xref:{cq-camel-components}::activemq-component.adoc[ActiveMQ component], URI syntax: `activemq:destinationType:destinationName` | ||
|
||
Please refer to the above link for usage and configuration details. | ||
|
||
[id="extensions-activemq-maven-coordinates"] | ||
== Maven coordinates | ||
|
||
https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-activemq[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"] | ||
|
||
Or add the coordinates to your existing project: | ||
|
||
[source,xml] | ||
---- | ||
<dependency> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-activemq</artifactId> | ||
</dependency> | ||
---- | ||
ifeval::[{doc-show-user-guide-link} == true] | ||
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. | ||
endif::[] | ||
|
||
[id="extensions-activemq-usage"] | ||
== Usage | ||
[id="extensions-activemq-usage-message-mapping-with-org-w3c-dom-node"] | ||
=== Message mapping with `org.w3c.dom.Node` | ||
|
||
The Camel ActiveMQ component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, | ||
you must ensure that the `camel-quarkus-xml-jaxp` extension is present on the classpath. | ||
|
||
[id="extensions-activemq-usage-native-mode-support-for-javax-jms-objectmessage"] | ||
=== Native mode support for javax.jms.ObjectMessage | ||
|
||
When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. | ||
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. | ||
|
||
|
||
[id="extensions-activemq-camel-quarkus-limitations"] | ||
== Camel Quarkus limitations | ||
|
||
ActiveMQ https://activemq.apache.org/selectors.html[XPath selectors] are disabled in native mode as the functionality depends on `activemq-broker`. This dependency | ||
is excluded from the dependency tree, since none of the ActiveMQ broker functionality is supported in native mode. | ||
|
||
|
||
[id="extensions-activemq-ssl-in-native-mode"] | ||
== SSL in native mode | ||
|
||
This extension auto-enables SSL support in native mode. Hence you do not need to add | ||
`quarkus.ssl.native=true` to your `application.properties` yourself. See also | ||
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide]. | ||
|
||
[id="extensions-activemq-transferexception-option-in-native-mode"] | ||
== transferException option in native mode | ||
|
||
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] | ||
for more information. | ||
|
||
You will also need to enable serialization for the exception classes that you intend to serialize. For example. | ||
[source,java] | ||
---- | ||
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true) | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?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>3.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>camel-quarkus-activemq-deployment</artifactId> | ||
<name>Camel Quarkus :: ActiveMQ :: Deployment</name> | ||
|
||
<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> | ||
</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> |
141 changes: 141 additions & 0 deletions
141
...c/main/java/org/apache/camel/quarkus/component/activemq/deployment/ActiveMQProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
/* | ||
* 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.Collection; | ||
import java.util.Properties; | ||
import java.util.stream.Stream; | ||
|
||
import io.quarkus.deployment.annotations.BuildProducer; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.CombinedIndexBuildItem; | ||
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.deployment.builditem.IndexDependencyBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; | ||
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; | ||
import org.apache.activemq.transport.Transport; | ||
import org.apache.activemq.transport.discovery.DiscoveryAgent; | ||
import org.apache.activemq.util.IdGenerator; | ||
import org.apache.activemq.wireformat.WireFormatFactory; | ||
import org.jboss.jandex.ClassInfo; | ||
import org.jboss.jandex.DotName; | ||
import org.jboss.jandex.IndexView; | ||
|
||
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 | ||
void reflectiveClasses( | ||
CombinedIndexBuildItem combinedIndex, | ||
BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) { | ||
|
||
reflectiveClasses.produce( | ||
ReflectiveClassBuildItem.builder( | ||
java.net.Socket.class.getName(), | ||
"sun.security.ssl.SSLSocketImpl", | ||
org.apache.activemq.ActiveMQConnectionFactory.class.getName(), | ||
org.apache.activemq.ActiveMQPrefetchPolicy.class.getName(), | ||
org.apache.activemq.RedeliveryPolicy.class.getName(), | ||
org.apache.activemq.blob.BlobTransferPolicy.class.getName(), | ||
org.apache.activemq.command.ConsumerInfo.class.getName(), | ||
org.apache.activemq.openwire.v9.MarshallerFactory.class.getName(), | ||
org.apache.activemq.openwire.v10.MarshallerFactory.class.getName(), | ||
org.apache.activemq.openwire.v11.MarshallerFactory.class.getName(), | ||
org.apache.activemq.openwire.v12.MarshallerFactory.class.getName()) | ||
.methods() | ||
.build()); | ||
|
||
final IndexView index = combinedIndex.getIndex(); | ||
|
||
reflectiveClasses.produce( | ||
ReflectiveClassBuildItem.builder( | ||
Stream.of(Transport.class, WireFormatFactory.class, DiscoveryAgent.class) | ||
.map(DotName::createSimple) | ||
.map(index::getAllKnownImplementors) | ||
.flatMap(Collection::stream) | ||
.map(ClassInfo::name) | ||
.map(DotName::toString) | ||
.toArray(String[]::new)) | ||
.methods() | ||
.build()); | ||
} | ||
|
||
@BuildStep | ||
void addDependencies(BuildProducer<IndexDependencyBuildItem> indexDependency) { | ||
indexDependency.produce(new IndexDependencyBuildItem("org.apache.activemq", "activemq-client-jakarta")); | ||
} | ||
|
||
@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)); | ||
} | ||
|
||
@BuildStep | ||
void runtimeReinitializedClasses(BuildProducer<RuntimeReinitializedClassBuildItem> runtimeReInitializedClass) { | ||
runtimeReInitializedClass.produce(new RuntimeReinitializedClassBuildItem(IdGenerator.class.getName())); | ||
} | ||
|
||
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); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?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-extensions</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath>../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> | ||
</project> |
Oops, something went wrong.