[jboss-cvs] JBoss Messaging SVN: r2906 - in trunk: src/main/org/jboss/jms/server/bridge and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 19 07:07:43 EDT 2007
Author: timfox
Date: 2007-07-19 07:07:43 -0400 (Thu, 19 Jul 2007)
New Revision: 2906
Modified:
trunk/src/main/org/jboss/jms/message/JBossMessage.java
trunk/src/main/org/jboss/jms/server/bridge/Bridge.java
trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java
Log:
Make sure JMSX properties are handled properly by the bridge
Modified: trunk/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/JBossMessage.java 2007-07-19 09:52:28 UTC (rev 2905)
+++ trunk/src/main/org/jboss/jms/message/JBossMessage.java 2007-07-19 11:07:43 UTC (rev 2906)
@@ -1073,7 +1073,7 @@
"' is reserved due to selector syntax.");
}
- if (name.regionMatches(false, 0, "JMSX", 0, 4) &&
+ if (name.startsWith("JMSX") &&
!name.equals("JMSXGroupID") &&
!name.equals("JMSXGroupSeq") &&
!name.equals("JMSXDeliveryCount"))
Modified: trunk/src/main/org/jboss/jms/server/bridge/Bridge.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/bridge/Bridge.java 2007-07-19 09:52:28 UTC (rev 2905)
+++ trunk/src/main/org/jboss/jms/server/bridge/Bridge.java 2007-07-19 11:07:43 UTC (rev 2906)
@@ -1286,7 +1286,7 @@
//We concatenate the old message id as a header in the message
//This allows the target to then use this as the JMSCorrelationID of any response message
//thus enabling a distributed request-response pattern.
- //Each bridge (if there are more than one) in the chain can contenate the message id
+ //Each bridge (if there are more than one) in the chain can concatenate the message id
//So in the case of multiple bridges having routed the message this can be used in a multi-hop
//distributed request/response
if (trace) { log.trace("Adding old message id in Message header"); }
@@ -1320,11 +1320,22 @@
while (iter2.hasNext())
{
Map.Entry entry = (Map.Entry)iter2.next();
-
- msg.setObjectProperty((String)entry.getKey(), entry.getValue());
+
+ String propName = (String)entry.getKey();
+
+ //It's illegal (or pointless) to set properties beginning with JMSX
+ //apart from JMSXGroupID, JMSXGroupSeq and JMSXDeliveryCount
+ //Also there's no point in setting JMSXDeliveryCount since it will get reset
+ //before the msg is received anyway
+ if (!propName.startsWith("JMSX") ||
+ propName.equals("JMSXGroupID") ||
+ propName.equals("JMSXGroupSeq"));
+ {
+ msg.setObjectProperty(propName, entry.getValue());
+ }
}
}
-
+
String val = null;
val = msg.getStringProperty(JBossMessage.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java 2007-07-19 09:52:28 UTC (rev 2905)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java 2007-07-19 11:07:43 UTC (rev 2906)
@@ -720,8 +720,7 @@
checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
- this.checkNoneReceived(cf1, destQueue, 5000);
-
+ this.checkNoneReceived(cf1, destQueue, 5000);
}
finally
{
@@ -863,6 +862,11 @@
tm.setBooleanProperty("cheese", true);
tm.setIntProperty("Sausages", 23);
+ //We add some JMSX ones too
+
+ tm.setStringProperty("JMSXGroupID", "mygroup543");
+ tm.setIntProperty("JMSXGroupSeq", 777);
+
prod.send(tm);
ids1.add(tm.getJMSMessageID());
@@ -890,6 +894,9 @@
assertTrue(tm.getBooleanProperty("cheese"));
assertEquals(23, tm.getIntProperty("Sausages"));
+ assertEquals("mygroup543", tm.getStringProperty("JMSXGroupID"));
+ assertEquals(777, tm.getIntProperty("JMSXGroupSeq"));
+
String header = tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);
assertNotNull(header);
@@ -928,6 +935,9 @@
assertTrue(tm.getBooleanProperty("cheese"));
assertEquals(23, tm.getIntProperty("Sausages"));
+ assertEquals("mygroup543", tm.getStringProperty("JMSXGroupID"));
+ assertEquals(777, tm.getIntProperty("JMSXGroupSeq"));
+
String header = tm.getStringProperty(JBossMessage.JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST);
assertNotNull(header);
More information about the jboss-cvs-commits
mailing list