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

    https://github.com/apache/activemq-artemis/pull/2464#discussion_r242205353
  
    --- Diff: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java
 ---
    @@ -216,9 +219,23 @@ public RemotingConnection getRemotingConnection() {
           flow();
        }
     
    -   public RoutingType getRoutingType(Receiver receiver, SimpleString 
address) {
    +   public RoutingType getRoutingType(Receiver receiver, SimpleString 
address, AMQPMessage message) {
           org.apache.qpid.proton.amqp.messaging.Target target = 
(org.apache.qpid.proton.amqp.messaging.Target) receiver.getRemoteTarget();
    -      return target != null ? getRoutingType(target.getCapabilities(), 
address) : getRoutingType((Symbol[]) null, address);
    +      // the target may be null or have no capabilities in the case of an 
anonymous producer
    +      if (target != null && target.getCapabilities() != null) {
    --- End diff --
    
    Doing this for each message seems a[n existing?] waste. Also, the comment 
and check aren't really achieving what seems to be desired, which is to know if 
its not an anonymous producer.
    
    This part of the process could be done once when the link first attaches, 
with the routing type value deduced and used here later rather than repeating 
the process over and over. The initial attachment is also a better point in 
time to establish whether it is an anonymous producer or not. The Anonymous 
Relay is represented by the target with null address, but nothing prevents 
there being capabilities associated with it, so this check could erroneously 
catch an anonymous producer link. It should inspect the link target address to 
make the distinction.


---

Reply via email to