You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2023/07/14 10:02:46 UTC

[dubbo] branch 3.2 updated: Fix anyMethodParameter using consumer first. (#12640) (#12641)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 68e624f764 Fix anyMethodParameter using consumer first. (#12640) (#12641)
68e624f764 is described below

commit 68e624f7643eeb1aa136a382e4432f3b77002f87
Author: stone lion <v1...@qq.com>
AuthorDate: Fri Jul 14 18:02:41 2023 +0800

    Fix anyMethodParameter using consumer first. (#12640) (#12641)
---
 .../org/apache/dubbo/registry/client/InstanceAddressURL.java   | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
index ff41fa05f2..d418030d6b 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/InstanceAddressURL.java
@@ -555,6 +555,16 @@ public class InstanceAddressURL extends URL {
      */
     @Override
     public String getAnyMethodParameter(String key) {
+        if (consumerParamFirst(key)) {
+            URL consumerUrl = RpcContext.getServiceContext().getConsumerUrl();
+            if (consumerUrl != null) {
+                String v = consumerUrl.getAnyMethodParameter(key);
+                if (StringUtils.isNotEmpty(v)) {
+                    return v;
+                }
+            }
+        }
+
         String suffix = "." + key;
         String protocolServiceKey = getProtocolServiceKey();
         if (StringUtils.isNotEmpty(protocolServiceKey)) {