zrlw commented on issue #15305:
URL: https://github.com/apache/dubbo/issues/15305#issuecomment-2988325610

   i tested your codes with current dubbo 3.3 branch and didn't find the issue. 
maybe you should try the current version.
   What i changed:
   1. modify pom.xml for running springboot testing on zookeeper
   ```
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               <artifactId>dubbo-spring-boot-starter</artifactId>
               <version>3.3.4-SNAPSHOT</version> <!-- mvn install on current 
dubbo 3.3 branch -->
           </dependency>
   
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-log4j2</artifactId>
               <version>3.2.3</version>
           </dependency>
   
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter</artifactId>
               <version>3.2.3</version>
               <exclusions>
                   <exclusion>
                       <artifactId>spring-boot-starter-logging</artifactId>
                       <groupId>org.springframework.boot</groupId>
                   </exclusion>
               </exclusions>
           </dependency>
   
           <dependency>
               <groupId>org.apache.dubbo</groupId>
               
<artifactId>dubbo-zookeeper-curator5-spring-boot-starter</artifactId>
               <version>3.3.4-SNAPSHOT</version>
           </dependency>
   <!--        <dependency>-->
   <!--            <groupId>com.alibaba.nacos</groupId>-->
   <!--            <artifactId>nacos-client</artifactId>-->
   <!--            <version>2.1.0</version>-->
   <!--        </dependency>-->
   ```
   2.  add output to MultiProviderRouter.java
   ```
   public class MultiProviderRouter extends AbstractRouter {
       @Override
       public <T> RouterResult<Invoker<T>> route(List<Invoker<T>> invokers,
                                                 URL url,
                                                 Invocation invocation,
                                                 boolean needToPrintMessage) 
throws RpcException {
           List<Invoker<T>> filteredInvokers = new ArrayList<>();
           System.out.println("invokers cnt: " + invokers.size());
           for (Invoker<T> invoker : invokers) {
               System.out.println("invoke: " + invoker);
               URL invokerUrl = invoker.getUrl();
               System.out.println("invokeUrl: " + invokerUrl);
               if (invokerUrl instanceof InstanceAddressURL) {
                   InstanceAddressURL instanceAddressURL = (InstanceAddressURL) 
invokerUrl;
                   String serviceName = 
instanceAddressURL.getInstance().getServiceName();
                   System.out.println("invokeUrl serviceName: " + serviceName);
                   if (serviceName.equals("demo-provider2")) {
                       System.out.println("add to filtered invokers " + 
invoker);
                       filteredInvokers.add(invoker);
                   }
               }
           }
   ```
   my test step (all steps just run only once time) :
   step1. start provider on 20880
    java -jar -DappName=demo-provider -Dport=20880 target/provider.jar
   step2: start consumer
   java -jar target/consumer.jar
   step3: start provider on 20881
    java -jar -DappName=demo-provider2 -Dport=20881 target/provider.jar
   output:
   
   
![Image](https://github.com/user-attachments/assets/a52b348e-f4e5-43f6-bb72-d904b1972571)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to