git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] activemq-artemis pull request #2392: ARTEMIS-2100 address routing-type overr...


Github user mtaylor commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/2392#discussion_r228899407
  
    --- Diff: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java ---
    @@ -229,7 +230,20 @@ private RoutingType getRoutingType(Symbol[] symbols, SimpleString address) {
                 }
              }
           }
    -
    +      //check any existing address routingTypes
    +      final AddressInfo addressInfo = sessionSPI.getAddress(address);
    +      if (addressInfo != null && !addressInfo.getRoutingTypes().isEmpty()) {
    +         if (addressInfo.getRoutingTypes().size() == 1) {
    +            return addressInfo.getRoutingType();
    +         }
    +         //try to pick the configured default routing type if between the already existing ones
    +         final RoutingType defaultRoutingType = sessionSPI.getDefaultRoutingType(address);
    +         if (defaultRoutingType != null && addressInfo.getRoutingTypes().contains(defaultRoutingType)) {
    +            return defaultRoutingType;
    +         }
    +         //prefer any existing routingType instead of the default one
    +         return addressInfo.getRoutingType();
    --- End diff --
    
    This doesn't work with auto-create enabled.  Also, the default routing type should never be null.  There is a default for the configuration setting.  ActiveMQDefaultConfiguration.getDefaultRoutingType() = MULTICAST.
    
    You can remove everything below this line and just return the default.


---