spring-cloud-alibaba How to route based on metadata by use spring cloud dubbo and nacos

pn9klfpd  于 2022-10-21  发布在  Spring
关注(0)|答案(5)|浏览(259)

If I want route by nacos metadata。In AbstractLoadBalance and AbstractRouter ,I can not get metadata from (List invokers, URL url, Invocation invocation)
what should I do?

vxf3dgd4

vxf3dgd42#

import org.springframework.cloud.client.serviceregistry.Registration;

    @Autowired
    private Registration registration;

   Map<String, String> metadata = registration.getMetadata();
11dmarpk

11dmarpk3#

NacosRule

import org.springframework.cloud.client.serviceregistry.Registration;

    @Autowired
    private Registration registration;

   Map<String, String> metadata = registration.getMetadata();

自己用dubbo 接口url 里的信息和nacos元数据进行关联吗,没有更合适的方式吗

yvfmudvl

yvfmudvl4#

refer NacosRule

NacosRule 在哪里

lpwwtiir

lpwwtiir5#

我怎样做才能在dubbo 进行路由和负载均衡时 拿到注册到nacos的元数据呢。我需要根据元数据进行路由,并且元数据是可以发生变化的

相关问题