From commits-return-61840-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Wed Sep 23 16:09:39 2020 Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mxout1-he-de.apache.org (mxout1-he-de.apache.org [95.216.194.37]) by minotaur.apache.org (Postfix) with ESMTP id 4973A19C5C for ; Wed, 23 Sep 2020 16:09:39 +0000 (UTC) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-he-de.apache.org (ASF Mail Server at mxout1-he-de.apache.org) with SMTP id 5126463F28 for ; Wed, 23 Sep 2020 16:09:38 +0000 (UTC) Received: (qmail 63819 invoked by uid 500); 23 Sep 2020 16:09:37 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 63787 invoked by uid 500); 23 Sep 2020 16:09:37 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 63777 invoked by uid 99); 23 Sep 2020 16:09:37 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Sep 2020 16:09:37 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 685CE8DCA0; Wed, 23 Sep 2020 16:09:37 +0000 (UTC) Date: Wed, 23 Sep 2020 16:09:37 +0000 To: "commits@activemq.apache.org" Subject: [activemq-artemis] branch master updated: ARTEMIS-2910: reuse routing type calculated in initialisation for fixed-address producers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <160087737711.21679.4899861917455464596@gitbox.apache.org> From: clebertsuconic@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: activemq-artemis X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 8ecd48fb93e89974cfbdfd3bc1481bd7a58ae2ec X-Git-Newrev: 6a4e79fd06facb7ebbcec8c5d6c52e7c043ff276 X-Git-Rev: 6a4e79fd06facb7ebbcec8c5d6c52e7c043ff276 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git The following commit(s) were added to refs/heads/master by this push: new 6a4e79f ARTEMIS-2910: reuse routing type calculated in initialisation for fixed-address producers new d7ba252 This closes #3270 6a4e79f is described below commit 6a4e79fd06facb7ebbcec8c5d6c52e7c043ff276 Author: Robbie Gemmell AuthorDate: Tue Sep 22 11:34:05 2020 +0100 ARTEMIS-2910: reuse routing type calculated in initialisation for fixed-address producers --- .../artemis/protocol/amqp/broker/AMQPSessionCallback.java | 11 ++++++----- .../protocol/amqp/proton/ProtonServerReceiverContext.java | 15 +++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java index 25cb4ab..141137b 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPSessionCallback.java @@ -466,9 +466,11 @@ public class AMQPSessionCallback implements SessionCallback { RoutingType routingType = null; if (address != null) { + // Fixed-address producer message.setAddress(address); + routingType = context.getDefRoutingType(); } else { - // Anonymous relay must set a To value + // Anonymous-relay producer, message must carry a To value address = message.getAddressSimpleString(); if (address == null) { // Errors are not currently handled as required by AMQP 1.0 anonterm-v1.0 @@ -477,13 +479,12 @@ public class AMQPSessionCallback implements SessionCallback { } routingType = message.getRoutingType(); + if (routingType == null) { + routingType = context.getRoutingType(receiver, address); + } } //here check queue-autocreation - if (routingType == null) { - routingType = context.getRoutingType(receiver, address); - } - if (!checkAddressAndAutocreateIfPossible(address, routingType)) { throw ActiveMQAMQPProtocolMessageBundle.BUNDLE.addressDoesntExist(); } diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java index b82067d..06e30d9 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/ProtonServerReceiverContext.java @@ -179,6 +179,8 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements private final int minLargeMessageSize; + private RoutingType defRoutingType; + public ProtonServerReceiverContext(AMQPSessionCallback sessionSPI, AMQPConnectionContext connection, AMQPSessionContext protonSession, @@ -229,8 +231,6 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements // We don't currently support SECOND so enforce that the answer is anlways FIRST receiver.setReceiverSettleMode(ReceiverSettleMode.FIRST); - RoutingType defRoutingType; - if (target != null) { if (target.getDynamic()) { // if dynamic we have to create the node (queue) and set the address on the target, the node is temporary and @@ -252,9 +252,12 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements // the target will have an address unless the remote is requesting an anonymous // relay in which case the address in the incoming message's to field will be // matched on receive of the message. - address = SimpleString.toSimpleString(target.getAddress()); + String targetAddress = target.getAddress(); + if (targetAddress != null && !targetAddress.isEmpty()) { + address = SimpleString.toSimpleString(targetAddress); + } - if (address != null && !address.isEmpty()) { + if (address != null) { defRoutingType = getRoutingType(target.getCapabilities(), address); try { if (!sessionSPI.checkAddressAndAutocreateIfPossible(address, defRoutingType)) { @@ -320,6 +323,10 @@ public class ProtonServerReceiverContext extends ProtonInitializable implements flow(); } + public RoutingType getDefRoutingType() { + return defRoutingType; + } + public RoutingType getRoutingType(Receiver receiver, SimpleString address) { 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);