[ 
https://issues.apache.org/jira/browse/ARTEMIS-2238?focusedWorklogId=189730&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-189730
 ]

ASF GitHub Bot logged work on ARTEMIS-2238:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Jan/19 23:01
            Start Date: 24/Jan/19 23:01
    Worklog Time Spent: 10m 
      Work Description: michaelandrepearce commented on pull request #2520: 
ARTEMIS-2238 Enhancement to queueQuery on producer
URL: https://github.com/apache/activemq-artemis/pull/2520#discussion_r250809792
 
 

 ##########
 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;
+               } else {
+                  RoutingType addressType = destination.isQueue() ? 
RoutingType.ANYCAST : RoutingType.MULTICAST;
+                  clientSession.createAddress(address, addressType, true);
+                  addressExists = true;
+               }
+            }
 
 Review comment:
   add else clause here with throws:
   
   then on debugging from logs with stack trace it would make it easier, as 
would get line where it errored out so could figure out. Also could then allow 
a better description so end users understand better,  e.g. 
   
   depending on destination.isQueue()
   
   "Queue " + address + " does not exist, auto create addresses is disabled."
   
   "Topic " + address + " does not exist, auto create addresses is disabled."
 
----------------------------------------------------------------
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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 189730)
    Time Spent: 3h 50m  (was: 3h 40m)

> JMS Producer queueQuery does not work when addressName != queueName
> -------------------------------------------------------------------
>
>                 Key: ARTEMIS-2238
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2238
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.6.4
>         Environment: this is a regression created at 
> f3ace6afd726dc8e3c1c58c76e3fad3d5cfa357d
>            Reporter: clebert suconic
>            Priority: Major
>             Fix For: 2.7.0, 2.6.5
>
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to