Skip to content

Commit

Permalink
Merge pull request #39 from ehsavoie/issue#38
Browse files Browse the repository at this point in the history
Issue#38: Upgrade to Apache Artemis 2.29
  • Loading branch information
ehsavoie authored Jun 20, 2023
2 parents 0cf98bc + 11b5e93 commit b4964d5
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 38 deletions.
36 changes: 33 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</licenses>

<properties>
<artemis.version>2.21.0</artemis.version>
<artemis.version>2.29.0</artemis.version>
<jboss-transaction-spi.version>7.6.1.Final</jboss-transaction-spi.version>
</properties>

Expand All @@ -44,12 +44,17 @@
<artifactId>jboss-logging</artifactId>
<version>3.5.0.Final</version>
</dependency>

<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<version>2.1.19.Final</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.36</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jakarta-service-extensions</artifactId>
Expand Down Expand Up @@ -103,6 +108,11 @@
<version>${artemis.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-log-annotation-processor</artifactId>
<version>${artemis.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq.tests</groupId>
<artifactId>unit-tests</artifactId>
Expand All @@ -114,6 +124,11 @@
<artifactId>integration-tests</artifactId>
<version>${artemis.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-unit-test-support</artifactId>
<version>${artemis.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq.tests</groupId>
<artifactId>integration-tests</artifactId>
Expand Down Expand Up @@ -170,6 +185,11 @@
<!--
JBoss Tools
-->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-log-annotation-processor</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
Expand Down Expand Up @@ -242,13 +262,23 @@
<artifactId>jbossjts-jacorb</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-unit-test-support</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@
*/
package org.jboss.activemq.artemis.wildfly;

import static org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactory.log;

import javax.security.auth.Subject;

import org.jboss.logging.BasicLogger;
import org.jboss.logging.Logger;
import org.jboss.logging.annotations.Cause;
import org.jboss.logging.annotations.LogMessage;
import org.jboss.logging.annotations.Message;
import org.jboss.logging.annotations.MessageLogger;
import org.apache.activemq.artemis.logs.BundleFactory;
import org.apache.activemq.artemis.logs.annotation.LogBundle;
import org.apache.activemq.artemis.logs.annotation.LogMessage;

/**
* @author <a href="mailto:[email protected]">Andy Taylor</a>
Expand All @@ -49,21 +43,18 @@
*
* so an INFO message would be 131000 to 131999
*/
@MessageLogger(projectCode = "AMQ")
public interface ActiveMQJBossLogger extends BasicLogger {

@LogBundle(projectCode = "AMQ", regexID = "13[0-9]{4}")
public interface ActiveMQJBossLogger {

/**
* The jboss integration logger.
*/
ActiveMQJBossLogger LOGGER = Logger.getMessageLogger(ActiveMQJBossLogger.class, ActiveMQJBossLogger.class.getPackage().getName());
ActiveMQJBossLogger LOGGER = BundleFactory.newBundle(ActiveMQJBossLogger.class, ActiveMQJBossLogger.class.getPackage().getName());

@LogMessage(level = Logger.Level.INFO)
@Message(id = 131001, value = "Security Context Setting Subject = {0}",
format = Message.Format.MESSAGE_FORMAT)
@LogMessage(id = 131001, value = "Security Context Setting Subject = {}", level = LogMessage.Level.INFO)
void settingSecuritySubject(Subject subject);

@LogMessage(level = Logger.Level.WARN)
@Message(id = 132001, value = "An error happened while setting the context",
format = Message.Format.MESSAGE_FORMAT)
void errorSettingSecurityContext(@Cause Throwable Throwable);
@LogMessage(id = 132001, value = "An error happened while setting the context", level = LogMessage.Level.WARN)
void errorSettingSecurityContext(Throwable Throwable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package org.jboss.activemq.artemis.wildfly.integration;

import static org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextFactory.log;

import java.lang.invoke.MethodHandles;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -25,6 +25,8 @@
import org.apache.activemq.artemis.core.remoting.impl.ssl.DefaultSSLContextFactory;
import org.apache.activemq.artemis.spi.core.remoting.ssl.SSLContextConfig;
import org.apache.activemq.artemis.utils.ConfigurationHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Implementation of the SSLContextFactory enabling WildFly to register and unregister SSLContext that it created.
Expand All @@ -33,7 +35,8 @@
*/
public class WildFlySSLContextFactory extends DefaultSSLContextFactory {

private static final Map<String, SSLContext> SSL_CONTEXTS = Collections.synchronizedMap(new HashMap<String, SSLContext>());
private static final Map<String, SSLContext> SSL_CONTEXTS = Collections.synchronizedMap(new HashMap<>());
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

/**
* Register a WildFly SSLContext.
Expand All @@ -43,7 +46,7 @@ public class WildFlySSLContextFactory extends DefaultSSLContextFactory {
*/
public static void registerSSLContext(String name, SSLContext context) {
SSL_CONTEXTS.put(name, context);
log.warnf("Injecting Elytron SSLContext %s", name);
log.warn("Injecting Elytron SSLContext " + name);
}

/**
Expand All @@ -68,9 +71,9 @@ public SSLContext getSSLContext(final SSLContextConfig config, final Map<String,
if (useDefaultSslContext) {
return SSLContext.getDefault();
}
log.debugf("Looking for Elytron SSLContext called %s", sslContextName);
log.debug("Looking for Elytron SSLContext called " + sslContextName);
if (!SSL_CONTEXTS.containsKey(sslContextName)) {
log.debugf("No Elytron SSLContext called %s found, creating it from the parameters", sslContextName);
log.debug("No Elytron SSLContext called " + sslContextName + " found, creating it from the parameters");
SSL_CONTEXTS.put(sslContextName, super.getSSLContext(config, additionalOpts));
}
return SSL_CONTEXTS.get(sslContextName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import java.util.Map;

import com.arjuna.ats.jta.recovery.XAResourceRecovery;
import java.lang.invoke.MethodHandles;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQXARecoveryLogger;
import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQXAResourceRecovery;
import org.apache.activemq.artemis.service.extensions.xa.recovery.ActiveMQXAResourceWrapper;
import org.apache.activemq.artemis.service.extensions.xa.recovery.XARecoveryConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* A XAResourceRecovery instance that can be used to recover any JMS provider.
Expand Down Expand Up @@ -53,21 +55,23 @@
*/
public class WildFlyActiveMQXAResourceRecovery extends ActiveMQXAResourceRecovery implements XAResourceRecovery {

private final boolean trace = ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled();
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final boolean trace = logger.isTraceEnabled();

private boolean hasMore;

private ActiveMQXAResourceWrapper res;

public WildFlyActiveMQXAResourceRecovery() {
if (trace) {
ActiveMQXARecoveryLogger.LOGGER.trace("Constructing ActiveMQXAResourceRecovery");
logger.trace("Constructing ActiveMQXAResourceRecovery");
}
}

public boolean initialise(final String config) {
if (ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled()) {
ActiveMQXARecoveryLogger.LOGGER.trace(this + " intialise: " + config);
if (trace) {
logger.trace(this + " intialise: " + config);
}

String[] configs = config.split(";");
Expand All @@ -85,16 +89,16 @@ public boolean initialise(final String config) {

res = new ActiveMQXAResourceWrapper(xaRecoveryConfigs);

if (ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled()) {
ActiveMQXARecoveryLogger.LOGGER.trace(this + " initialised");
if (trace) {
logger.trace(this + " initialised");
}

return true;
}

public boolean hasMoreResources() {
if (ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled()) {
ActiveMQXARecoveryLogger.LOGGER.trace(this + " hasMoreResources");
if (trace) {
logger.trace(this + " hasMoreResources");
}

/*
Expand All @@ -115,14 +119,16 @@ public boolean hasMoreResources() {
return hasMore;
}

@Override
public XAResource getXAResource() {
if (ActiveMQXARecoveryLogger.LOGGER.isTraceEnabled()) {
ActiveMQXARecoveryLogger.LOGGER.trace(this + " getXAResource");
if (trace) {
logger.trace(this + " getXAResource");
}

return res;
}

@Override
public XAResource[] getXAResources() {
return new XAResource[]{res};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
public class WildFlyTransactionManagerLocator implements org.apache.activemq.artemis.service.extensions.transactions.TransactionManagerLocator {

@Override
public TransactionManager getTransactionManager() {
return TransactionManagerLocator.locateTransactionManager();
}
Expand Down

0 comments on commit b4964d5

Please sign in to comment.