michaelandrepearce commented on a change in pull request #2520: ARTEMIS-2238 
Enhancement to queueQuery on producer
URL: https://github.com/apache/activemq-artemis/pull/2520#discussion_r250816406
 
 

 ##########
 File path: 
artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
 ##########
 @@ -533,6 +499,67 @@ private void doSendx(ActiveMQDestination destination,
       }
    }
 
+   private void checkDestination(ActiveMQDestination destination,
+                                 SimpleString address,
+                                 ClientSession clientSession) throws 
JMSException {
+
+      // TODO: What to do with FQQN
+      if (!connection.containsKnownDestination(address)) {
+         try {
+            ClientSession.AddressQuery addressQuery = 
clientSession.addressQuery(address);
+
+            boolean addressExists = addressQuery.isExists();
+            // first we check the address existence, and autoCreate it if 
allowed in case it does not exists
+
+            if (!addressExists && addressQuery.isAutoCreateAddresses()) {
+
+               if (destination.isQueue() && 
!addressQuery.isAutoCreateQueues()) {
+                  if (logger.isDebugEnabled()) {
+                     logger.debug("Address " + address + " was not created 
because we would not have permission to create queue");
+                  }
+                  // if it can't create the internal queue on JMS Queues, why 
bother creating the address, just mark it false now
+                  addressExists = false;
 
 Review comment:
   maybe use generic Destination, instead of Queue, to avoid confusion between 
JMSQueue and "core" Queue.
   
   "Destination " + address + " does not exist, auto create addresses is 
enabled, but auto create queues is not."

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to