[jboss-cvs] JBoss Messaging SVN: r3770 - branches/Branch_JBossMessaging_1_4_0_SP3_CP/src/main/org/jboss/jms/server/bridge.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Feb 22 10:28:04 EST 2008


Author: jmesnil
Date: 2008-02-22 10:28:04 -0500 (Fri, 22 Feb 2008)
New Revision: 3770

Modified:
   branches/Branch_JBossMessaging_1_4_0_SP3_CP/src/main/org/jboss/jms/server/bridge/BridgeService.java
Log:
* http://jira.jboss.org/jira/browse/JBMESSAGING-1183 - Message Bridge use QueueFactoryRef or TopicFactoryRef instead of FactoryRef
  - merged from r3768 of Branch_Stable

Modified: branches/Branch_JBossMessaging_1_4_0_SP3_CP/src/main/org/jboss/jms/server/bridge/BridgeService.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_0_SP3_CP/src/main/org/jboss/jms/server/bridge/BridgeService.java	2008-02-22 15:22:42 UTC (rev 3769)
+++ branches/Branch_JBossMessaging_1_4_0_SP3_CP/src/main/org/jboss/jms/server/bridge/BridgeService.java	2008-02-22 15:28:04 UTC (rev 3770)
@@ -23,7 +23,11 @@
 
 import java.util.Properties;
 
+import javax.jms.Destination;
+import javax.jms.Topic;
 import javax.management.ObjectName;
+import javax.naming.Context;
+import javax.naming.InitialContext;
 
 import org.jboss.messaging.core.contract.MessagingComponent;
 import org.jboss.system.ServiceMBeanSupport;
@@ -313,9 +317,25 @@
       
       Properties targetProps = (Properties)server.getAttribute(targetProviderLoader, "Properties");
       
-      String sourceCFRef = (String)server.getAttribute(sourceProviderLoader, "FactoryRef");
+      // JBMESSAGING-1183: set the factory refs according to the destinations types
+      Context icSource = new InitialContext(sourceProps);      
+      Context icTarget = new InitialContext(targetProps);
+      Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
+      Destination targetDest = (Destination)icTarget.lookup(targetDestinationLookup);
+      String sourceFactoryRef = "QueueFactoryRef";
+      if(sourceDest instanceof Topic)
+      {
+         sourceFactoryRef = "TopicFactoryRef";
+      }
+      String targetFactoryRef = "QueueFactoryRef";
+      if(targetDest instanceof Topic)
+      {
+         targetFactoryRef = "TopicFactoryRef";
+      }
+
+      String sourceCFRef = (String)server.getAttribute(sourceProviderLoader, sourceFactoryRef);
       
-      String targetCFRef = (String)server.getAttribute(targetProviderLoader, "FactoryRef");
+      String targetCFRef = (String)server.getAttribute(targetProviderLoader, targetFactoryRef);
       
       ConnectionFactoryFactory sourceCff =
          new JNDIConnectionFactoryFactory(sourceProps, sourceCFRef);




More information about the jboss-cvs-commits mailing list