[hornetq-commits] JBoss hornetq SVN: r8902 - trunk/src/main/org/hornetq/jms/client.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Feb 26 09:37:37 EST 2010


Author: ataylor
Date: 2010-02-26 09:37:37 -0500 (Fri, 26 Feb 2010)
New Revision: 8902

Modified:
   trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-314 - add check for temp queues

Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnection.java	2010-02-26 01:06:23 UTC (rev 8901)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnection.java	2010-02-26 14:37:37 UTC (rev 8902)
@@ -311,9 +311,23 @@
                                                       final int maxMessages) throws JMSException
    {
       checkClosed();
+
+      checkTempQueues(destination);
       return null;
    }
 
+   private void checkTempQueues(Destination destination)
+         throws JMSException
+   {
+      HornetQDestination jbdest = (HornetQDestination)destination;
+
+      if (jbdest.isTemporary() && !containsTemporaryQueue(jbdest.getSimpleAddress()))
+      {
+         throw new JMSException("Can not create consumer for temporary destination " + destination +
+                                " from another JMS connection");
+      }
+   }
+
    public ConnectionConsumer createDurableConnectionConsumer(final Topic topic,
                                                              final String subscriptionName,
                                                              final String messageSelector,
@@ -327,7 +341,7 @@
          String msg = "Cannot create a durable connection consumer on a QueueConnection";
          throw new javax.jms.IllegalStateException(msg);
       }
-
+      checkTempQueues(topic);
       // TODO
       return null;
    }
@@ -346,7 +360,7 @@
                                                       final int maxMessages) throws JMSException
    {
       checkClosed();
-
+      checkTempQueues(queue);
       return null;
    }
 
@@ -364,7 +378,7 @@
                                                       final int maxMessages) throws JMSException
    {
       checkClosed();
-
+      checkTempQueues(topic);
       return null;
    }
 



More information about the hornetq-commits mailing list