Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8bb7ad2dd -> 075004c4f


ARTEMIS-1658 Add prefix option to ActivationSpec

Artemis 1.x RA would do a core queue lookup if it could not find the
Destination in JNDI.  We need to ensure that we can support the old
address model for backwards compatability.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/8f47cd6e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/8f47cd6e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/8f47cd6e

Branch: refs/heads/master
Commit: 8f47cd6e14d4f51995272feaae9460dd95e03fe5
Parents: 8bb7ad2
Author: Martyn Taylor <mtay...@redhat.com>
Authored: Thu Feb 1 15:52:25 2018 +0000
Committer: Justin Bertram <jbert...@apache.org>
Committed: Fri Feb 2 13:46:51 2018 -0600

----------------------------------------------------------------------
 .../artemis/ra/inflow/ActiveMQActivation.java   |  5 ++++
 .../ra/inflow/ActiveMQActivationSpec.java       | 29 ++++++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8f47cd6e/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java
----------------------------------------------------------------------
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 97498a2..ede1b01 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() +

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8f47cd6e/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java
----------------------------------------------------------------------
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 fed36db..d46b2a7 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;
    }
 }

Reply via email to