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

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

                Author: ASF GitHub Bot
            Created on: 25/Jan/19 00:35
            Start Date: 25/Jan/19 00:35
    Worklog Time Spent: 10m 
      Work Description: michaelandrepearce commented on pull request #2521: 
ARTEMIS-2238 Enhancement to queueQuery on producer
URL: https://github.com/apache/activemq-artemis/pull/2521#discussion_r250828872
 
 

 ##########
 File path: 
artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
 ##########
 @@ -409,33 +409,42 @@ private void doSendx(ActiveMQDestination destination,
                ClientSession.AddressQuery query = 
clientSession.addressQuery(address);
 
                if (!query.isExists()) {
-                  if (destination.isQueue() && query.isAutoCreateQueues()) {
-                     clientSession.createAddress(address, RoutingType.ANYCAST, 
true);
-                     if (destination.isTemporary()) {
-                        // TODO is it right to use the address for the queue 
name here?
-                        session.createTemporaryQueue(destination, 
RoutingType.ANYCAST, address, null, query);
+                  if (destination.isQueue()) {
+                     if (query.isAutoCreateAddresses() && 
query.isAutoCreateQueues()) {
+                        clientSession.createAddress(address, 
RoutingType.ANYCAST, true);
+                        if (destination.isTemporary()) {
+                           // TODO is it right to use the address for the 
queue name here?
+                           session.createTemporaryQueue(destination, 
RoutingType.ANYCAST, address, null, query);
+                        } else {
+                           session.createQueue(destination, 
RoutingType.ANYCAST, address, null, true, true, query);
+                        }
                      } else {
-                        session.createQueue(destination, RoutingType.ANYCAST, 
address, null, true, true, query);
+                        throw new InvalidDestinationException("JMSQueue " + 
address + " cannot be created, autoCreateAddresses is " + 
query.isAutoCreateAddresses() + " , isAutoCreateQueues=" + 
query.isAutoCreateQueues());
+                     }
+                  } else {
+                     if (query.isAutoCreateAddresses()) {
+                        clientSession.createAddress(address, 
RoutingType.MULTICAST, true);
+                     } else {
+                        throw new InvalidDestinationException("JMSTopic " + 
address + " cannot be created, autoCreateAddresses is " + 
query.isAutoCreateAddresses());
                      }
-                  } else if (!destination.isQueue() && 
query.isAutoCreateAddresses()) {
-                     clientSession.createAddress(address, 
RoutingType.MULTICAST, true);
-                  } else if ((destination.isQueue() && 
!query.isAutoCreateQueues()) || (!destination.isQueue() && 
!query.isAutoCreateAddresses())) {
-                     throw new InvalidDestinationException("Destination " + 
address + " does not exist");
                   }
                } else {
                   if (destination.isQueue()) {
                      ClientSession.QueueQuery queueQuery = 
clientSession.queueQuery(address);
                      if (!queueQuery.isExists()) {
-                        if (destination.isTemporary()) {
-                           session.createTemporaryQueue(destination, 
RoutingType.ANYCAST, address, null, query);
+                        if (query.isAutoCreateQueues()) {
+                           if (destination.isTemporary()) {
+                              session.createTemporaryQueue(destination, 
RoutingType.ANYCAST, address, null, query);
+                           } else {
+                              session.createQueue(destination, 
RoutingType.ANYCAST, address, null, true, true, query);
+                           }
                         } else {
-                           session.createQueue(destination, 
RoutingType.ANYCAST, address, null, true, true, query);
+                           throw new InvalidDestinationException("JMSQueue " + 
address + " cannot be created, address exists but autoCreateQueues is " + 
query.isAutoCreateQueues());
 
 Review comment:
   re defaultDestination, i dont beleive it has to, as when creating the 
Producer in ActiveMQSession the queue / addresses are created then. 
   
   If anything if a defaultDestination exists, then we SHOULD not need go into 
this code, as if one exists then any supplied destination must == 
defaultDestination anyhow. And this has to be created at the point of creation 
of the producer, for the fact it has to fail to create a producer if it cannot 
create/bind to the defaultDestination at that point.
   
   If anything some rationalisation probably (e.g. its all the same logic. 
ironically and frustratingly with differences which really there shouldn't be) 
could occur, with some of the logic being shared and pushed in ActiveMQSession
 
----------------------------------------------------------------
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: 189803)
    Time Spent: 8h 20m  (was: 8h 10m)

> 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: 8h 20m
>  Remaining Estimate: 0h
>




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

Reply via email to