activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1141124 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/network/ test/java/org/apache/activemq/usecases/ test/resources/org/apache/activemq/usecases/
Date Wed, 29 Jun 2011 14:58:05 GMT
Author: dejanb
Date: Wed Jun 29 14:58:04 2011
New Revision: 1141124

URL: http://svn.apache.org/viewvc?rev=1141124&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-3382 - statically included destination should be
always forwarded

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestBrokerConnectionDuplexExcludedDestinations.java
    activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/sender-duplex.xml

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java?rev=1141124&r1=1141123&r2=1141124&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/network/DemandForwardingBridgeSupport.java
Wed Jun 29 14:58:04 2011
@@ -954,7 +954,18 @@ public abstract class DemandForwardingBr
             }
         }
 
-        ActiveMQDestination[] dests = excludedDestinations;
+        ActiveMQDestination[] dests = staticallyIncludedDestinations;
+        if (dests != null && dests.length > 0) {
+            for (int i = 0; i < dests.length; i++) {
+                ActiveMQDestination match = dests[i];
+                DestinationFilter inclusionFilter = DestinationFilter.parseFilter(match);
+                if (match != null && inclusionFilter.matches(destination) &&
dests[i].getDestinationType() == destination.getDestinationType()) {
+                    return true;
+                }
+            }
+        }
+
+        dests = excludedDestinations;
         if (dests != null && dests.length > 0) {
             for (int i = 0; i < dests.length; i++) {
                 ActiveMQDestination match = dests[i];

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestBrokerConnectionDuplexExcludedDestinations.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestBrokerConnectionDuplexExcludedDestinations.java?rev=1141124&r1=1141123&r2=1141124&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestBrokerConnectionDuplexExcludedDestinations.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/usecases/TestBrokerConnectionDuplexExcludedDestinations.java
Wed Jun 29 14:58:04 2011
@@ -101,6 +101,12 @@ public class TestBrokerConnectionDuplexE
 		hubProducer.setDisableMessageID(true);
 		hubProducer.setDisableMessageTimestamp(true);
 
+		//create spoke producer
+		MessageProducer spokeProducer = hubSession.createProducer(null);
+		spokeProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+		spokeProducer.setDisableMessageID(true);
+		spokeProducer.setDisableMessageTimestamp(true);
+
 		Queue excludedQueueHub = hubSession.createQueue("exclude.test.foo");
 		TextMessage excludedMsgHub = hubSession.createTextMessage();
 		excludedMsgHub.setText(excludedQueueHub.toString());
@@ -108,11 +114,17 @@ public class TestBrokerConnectionDuplexE
 		Queue includedQueueHub = hubSession.createQueue("include.test.foo");
 
 		TextMessage includedMsgHub = hubSession.createTextMessage();
-		includedMsgHub.setText(includedQueueHub.toString());		
+		includedMsgHub.setText(includedQueueHub.toString());
+
+		Queue alwaysIncludedQueueHub = hubSession.createQueue("always.include.test.foo");
+
+		TextMessage alwaysIncludedMsgHub = hubSession.createTextMessage();
+		alwaysIncludedMsgHub.setText(alwaysIncludedQueueHub.toString());
 
 		// Sending from Hub queue
 		hubProducer.send(excludedQueueHub, excludedMsgHub);
 		hubProducer.send(includedQueueHub, includedMsgHub);
+        hubProducer.send(alwaysIncludedQueueHub, alwaysIncludedMsgHub);
 
 
 		Queue excludedQueueSpoke = spokeSession.createQueue("exclude.test.foo");
@@ -121,7 +133,21 @@ public class TestBrokerConnectionDuplexE
 		Thread.sleep(100);
 
 	    Queue includedQueueSpoke = spokeSession.createQueue("include.test.foo");
-		MessageConsumer includedConsumerSpoke = spokeSession.createConsumer(includedQueueSpoke);
	
+		MessageConsumer includedConsumerSpoke = spokeSession.createConsumer(includedQueueSpoke);
+
+		Thread.sleep(100);
+
+	    Queue alwaysIncludedQueueSpoke = spokeSession.createQueue("always.include.test.foo");
+		MessageConsumer alwaysIncludedConsumerSpoke = spokeSession.createConsumer(alwaysIncludedQueueHub);
+
+        Thread.sleep(100);
+        TextMessage alwaysIncludedMsgSpoke = spokeSession.createTextMessage();
+		alwaysIncludedMsgSpoke.setText(alwaysIncludedQueueSpoke.toString());
+        spokeProducer.send(alwaysIncludedQueueSpoke, alwaysIncludedMsgSpoke);
+
+
+		MessageConsumer alwaysIncludedConsumerHub = spokeSession.createConsumer(alwaysIncludedQueueHub);
+
 		
 		// Receiving from excluded Spoke queue
 		Message msg = excludedConsumerSpoke.receive(200);
@@ -130,6 +156,10 @@ public class TestBrokerConnectionDuplexE
 		// Receiving from included Spoke queue
 		msg = includedConsumerSpoke.receive(200);
 		assertEquals(includedMsgHub, msg);
+
+		// Receiving from included Spoke queue
+		msg = alwaysIncludedConsumerSpoke.receive(200);
+		assertEquals(alwaysIncludedMsgHub, msg);
 		
 		// we should be able to receive excluded queue message on Hub
 		MessageConsumer excludedConsumerHub = hubSession.createConsumer(excludedQueueHub);

Modified: activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/sender-duplex.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/sender-duplex.xml?rev=1141124&r1=1141123&r2=1141124&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/sender-duplex.xml
(original)
+++ activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/usecases/sender-duplex.xml
Wed Jun 29 14:58:04 2011
@@ -40,8 +40,8 @@
       		<topic physicalName="exclude.test.bar"/>
       	</excludedDestinations>
         <staticallyIncludedDestinations>
-      		<queue physicalName="always.include.queue"/>
-      		<topic physicalName="always.include.topic"/>
+      		<queue physicalName="always.include.test.foo"/>
+      		<topic physicalName="always.include.test.bar"/>
       	</staticallyIncludedDestinations>
 
       </networkConnector>



Mime
View raw message