-
Notifications
You must be signed in to change notification settings - Fork 912
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARTEMIS-4567 support OpenWire clients for broker embedded in Jakarta …
…environment If the broker is embedded into a Jakarta environment then the existing artemis-openwire-protocol module won't work because it uses javax classes. This commit adds a new Jakarta-specific module that can be used to support OpenWire clients in Jakarta environments (e.g. Spring Boot 3). Users will simply need to include this version on their classpath to enable support.
- Loading branch information
Showing
7 changed files
with
274 additions
and
0 deletions.
There are no files selected for viewing
152 changes: 152 additions & 0 deletions
152
artemis-protocols/artemis-jakarta-openwire-protocol/pom.xml
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,152 @@ | ||
<!-- | ||
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> | ||
<artifactId>artemis-protocols</artifactId> | ||
<groupId>org.apache.activemq</groupId> | ||
<version>2.32.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>artemis-jakarta-openwire-protocol</artifactId> | ||
<packaging>bundle</packaging> | ||
<name>ActiveMQ Artemis Jakarta OpenWire Protocol</name> | ||
<description>To support OpenWire clients from an embedded broker deployed in a Jakarta environment (e.g. Spring Boot 3)</description> | ||
|
||
<properties> | ||
<activemq.basedir>${project.basedir}/../..</activemq.basedir> | ||
<jakarta.jms-api.version>${jakarta.jms-api.version.alt}</jakarta.jms-api.version> | ||
<jakarta.transaction-api.version>${jakarta.transaction-api.version.alt}</jakarta.transaction-api.version> | ||
<jakarta.resource-api.version>${jakarta.resource-api.version.alt}</jakarta.resource-api.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- logging --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j2-impl</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>activemq-client-jakarta</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-jakarta-server</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-jakarta-client</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-core-client</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-commons</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-journal</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-selector</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.jms</groupId> | ||
<artifactId>jakarta.jms-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.fusesource.hawtbuf</groupId> | ||
<artifactId>hawtbuf</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-buffer</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-transport</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-codec</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.osgi</groupId> | ||
<artifactId>osgi.cmpn</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.activemq</groupId> | ||
<artifactId>artemis-unit-test-support</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.wildfly.extras.batavia</groupId> | ||
<artifactId>transformer-tools-mvn</artifactId> | ||
<executions> | ||
<execution> | ||
<id>transform-sources</id> | ||
<phase>generate-sources</phase> | ||
<goals> | ||
<goal>transform-sources</goal> | ||
</goals> | ||
<configuration> | ||
<source-project>${project.basedir}/../artemis-openwire-protocol</source-project> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.wildfly.extras.batavia</groupId> | ||
<artifactId>transformer-impl-eclipse</artifactId> | ||
<version>${version.batavia}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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
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
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
31 changes: 31 additions & 0 deletions
31
tests/compatibility-tests/src/main/resources/openWireJakarta/artemisJakartaServer.groovy
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,31 @@ | ||
/* | ||
* 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. | ||
*/ | ||
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl | ||
import org.apache.activemq.artemis.core.server.JournalType | ||
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ | ||
|
||
String folder = arg[0] | ||
|
||
configuration = new ConfigurationImpl() | ||
configuration.setJournalType(JournalType.NIO) | ||
configuration.setBrokerInstance(new File(folder + "/server")) | ||
configuration.addAcceptorConfiguration("artemis", "tcp://0.0.0.0:61616") | ||
configuration.setSecurityEnabled(false) | ||
configuration.setPersistenceEnabled(false) | ||
server = new EmbeddedActiveMQ() | ||
server.setConfiguration(configuration) | ||
server.start() |
46 changes: 46 additions & 0 deletions
46
tests/compatibility-tests/src/main/resources/openWireJakarta/sendReceiveOW.groovy
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,46 @@ | ||
/* | ||
* 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. | ||
*/ | ||
import org.apache.activemq.artemis.tests.compatibility.GroovyRun | ||
|
||
import javax.jms.Message | ||
import javax.jms.MessageConsumer | ||
import javax.jms.MessageProducer | ||
import javax.jms.Queue | ||
import javax.jms.Session | ||
import org.apache.activemq.ActiveMQConnectionFactory | ||
|
||
final ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("tcp://localhost:61616") | ||
connection = cf.createConnection() | ||
try { | ||
final int numberOfMessages = Integer.parseInt(arg[0]) | ||
final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE) | ||
final Queue queue = session.createQueue(arg[1]) | ||
final MessageProducer producer = session.createProducer(queue) | ||
for (i in 0..<numberOfMessages) { | ||
producer.send(session.createMessage()) | ||
} | ||
|
||
final MessageConsumer consumer = session.createConsumer(queue) | ||
connection.start() | ||
|
||
for (i in 0..<numberOfMessages) { | ||
final Message m = consumer.receive(1000) | ||
GroovyRun.assertNotNull(m) | ||
} | ||
} finally { | ||
connection.close() | ||
} |
35 changes: 35 additions & 0 deletions
35
...ts/src/test/java/org/apache/activemq/artemis/tests/compatibility/OpenWireJakartaTest.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,35 @@ | ||
/* | ||
* 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.activemq.artemis.tests.compatibility; | ||
|
||
import org.apache.activemq.artemis.tests.compatibility.base.ClasspathBase; | ||
import org.junit.Test; | ||
|
||
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.AMQ_5_11; | ||
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE; | ||
|
||
public class OpenWireJakartaTest extends ClasspathBase { | ||
|
||
@Test | ||
public void testOpenWireJakarta() throws Throwable { | ||
ClassLoader serverClassloader = getClasspath(JAKARTAEE); | ||
evaluate(serverClassloader, "openWireJakarta/artemisJakartaServer.groovy", "openWireJakarta"); | ||
evaluate(getClasspath(AMQ_5_11), "openWireJakarta/sendReceiveOW.groovy", "20", "test"); | ||
execute(serverClassloader, "server.stop()"); | ||
} | ||
} |