diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java index 97498a2679..ede1b01ede 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java @@ -542,6 +542,11 @@ public class ActiveMQActivation { } String calculatedDestinationName = destinationName.substring(destinationName.lastIndexOf('/') + 1); + if (isTopic && spec.getTopicPrefix() != null) { + calculatedDestinationName = spec.getTopicPrefix() + calculatedDestinationName; + } else if (!isTopic && spec.getQueuePrefix() != null) { + calculatedDestinationName = spec.getQueuePrefix() + calculatedDestinationName; + } logger.debug("Unable to retrieve " + destinationName + " from JNDI. Creating a new " + destinationType.getName() + diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java index fed36db895..d46b2a79d7 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java @@ -53,6 +53,7 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen public String strConnectionParameters; protected Boolean allowLocalTransactions; + /** * The resource adapter */ @@ -135,6 +136,11 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen private Boolean rebalanceConnections = false; + // Enables backwards compatibility of the pre 2.x addressing model + private String topicPrefix; + + private String queuePrefix; + /** * Constructor */ @@ -368,6 +374,23 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen } } + + public void setQueuePrefix(String prefix) { + this.queuePrefix = prefix; + } + + public String getQueuePrefix() { + return queuePrefix; + } + + public void setTopicPrefix(String prefix) { + this.topicPrefix = prefix; + } + + public String getTopicPrefix() { + return topicPrefix; + } + /** * Set the acknowledge mode * @@ -878,6 +901,10 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen return false; if (setupAttempts != null ? !setupAttempts.equals(that.setupAttempts) : that.setupAttempts != null) return false; + if (queuePrefix != null ? !queuePrefix.equals(that.queuePrefix) : that.queuePrefix != null) + return false; + if (topicPrefix != null ? !topicPrefix.equals(that.topicPrefix) : that.topicPrefix != null) + return false; return !(setupInterval != null ? !setupInterval.equals(that.setupInterval) : that.setupInterval != null); } @@ -907,6 +934,8 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen result = 31 * result + (rebalanceConnections != null ? rebalanceConnections.hashCode() : 0); result = 31 * result + (setupAttempts != null ? setupAttempts.hashCode() : 0); result = 31 * result + (setupInterval != null ? setupInterval.hashCode() : 0); + result = 31 * result + (queuePrefix != null ? queuePrefix.hashCode() : 0); + result = 31 * result + (topicPrefix != null ? queuePrefix.hashCode() :0); return result; } }