You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/11 06:29:46 UTC

[GitHub] [dubbo] JasonMing opened a new issue #8470: 提供可控的 `Invoker` 链组装过程。

JasonMing opened a new issue #8470:
URL: https://github.com/apache/dubbo/issues/8470


   当前 provider/consumer 的 `Invoker` 链组装完全由 `Protocol` 控制,使用者除了通过SPI基础**插入**新的或**替换**现有的节点。
   但,没有一个整体的方式对整个 `Invoker` 链进行控制。
   比如,如果我引入了sentinel的dubbo支持包,由于里面的 `Filter` 存在 `@Activate`,总是会自动激活,如果需要排除需要通过用户自己配置 `dubbo.consumer/provider.filter`,这一部分如果在团队中想做成公共的逻辑则会非常艰难(因为 filter 总是覆盖而非追加)。
   如果可以提供一个机制用以给用户来修改 `Invoker` 链,例如:
   
   ```java
   InvokerUtils.modifyInvokerChain(reference, (InvokerChain invokerChain) -> {
       // 这里可以特定修改 Invoker 链。
   });
   ```
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn commented on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
plusmancn commented on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-904750134


   > (因为 filter 总是覆盖而非追加)
   
   @JasonMing When I refer to the official docs, it says:
   > provider 和 service 同时配置的 filter 时,累加所有 filter,而不是覆盖。比如:<dubbo:provider filter="xxx,yyy"/> 和 <dubbo:service filter="aaa,bbb" />,则 xxx,yyy,aaa,bbb 均会生效。如果要覆盖,需配置:<dubbo:service filter="-xxx,-yyy,aaa,bbb" />
   
   and I have verified it by the following config,  `AFilter` was annotated by `@Activate`,  the `AFilter` didn't appear in RPC producer, but `BFilter` dit as expected. 
   ```xml
   
   <dubbo:consumer filter="-a"/> 
   <dubbo:reference filter="b"/>
   ```
   
   But I found another problem that we have no config option to control `AFilter` not appaerning in `getMetadataInfo` process.
   ```java
   metadataInfo = metadataServiceProxy
              .getMetadataInfo(ServiceInstanceMetadataUtils.getExportedServicesRevision(instance));
   ```
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] JasonMing commented on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
JasonMing commented on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-899334517


   ## Configurable `InvokerChain`
   
   The configurer mechanism is inspired by spring-webmvc's [`WebMvcConfigurer`](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/servlet/config/annotation/WebMvcConfigurer.html).
   It is a post processor provides a chance for user to change internal components programatically.
   
   The most important thing is, the `Invoker` model should be transparent to the users are **using** it, but should be configurable and expose details to the users are **configuring** it.
   
   ### `InovkerChainConfigurer` SPI
   
   The configurer is a callback essentially, the configurer will setup every components properly.
   
   ```java
   @SPI
   interface InovkerChainConfigurer {
       default void configurerRegistry(RegistryHandler handler) {}
       default void configureFilters(FilterHandler handler) {}
       // other hooks ......
   }
   ```
   
   The configuration code
   ```java
   class MyInovkerChainConfigurer implements InovkerChainConfigurer {
   
       @Override
       void configurerRegistry(RegistryHandler handler) {
           handler.setRegistryDirectory(......);
       }
   
       @Override
       void configurerFilters(FilterHanlder handler) {
           handler.remove(sentinelFilter);
       }
   }
   ```


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] JasonMing commented on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
JasonMing commented on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-906192013


   @plusmancn 
   
   While the `filter` config appears in different level (e.g., consumer and reference) will be merged.
   But, consider this case:
   A common component try to disable an `@Activate` filter "a" by `setFilter("-a")` programatically.
   This action will override the user setting from *.xml or application.yml.
   And, while calling `setFilter("-a")`, there is no guarantee the filter will not be set again by dubbo framework, if so, our setting will be invalid.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn commented on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
plusmancn commented on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-907015702


   @JasonMing Get.
   
   Before we implement it, we should give a more detailed technical schema which may need to consider the compatibility with the multi-instance feature of 3.0.3 (will release soon).


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn edited a comment on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
plusmancn edited a comment on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-904750134


   > (因为 filter 总是覆盖而非追加)
   
   @JasonMing When I refer to the official docs, it says:
   > provider 和 service 同时配置的 filter 时,累加所有 filter,而不是覆盖。比如:<dubbo:provider filter="xxx,yyy"/> 和 <dubbo:service filter="aaa,bbb" />,则 xxx,yyy,aaa,bbb 均会生效。如果要覆盖,需配置:<dubbo:service filter="-xxx,-yyy,aaa,bbb" />
   
   and I have verified it by the following config,  `AFilter` was annotated by `@Activate`,  the `AFilter` didn't appear in RPC producer, but `BFilter` did as expected.  So maybe it's helpful for your confusion.
   ```xml
   
   <dubbo:consumer filter="-a"/> 
   <dubbo:reference filter="b"/>
   ```
   
   But I found another problem that we have no config option to control `AFilter` not appaerning in `getMetadataInfo` process.
   ```java
   metadataInfo = metadataServiceProxy
              .getMetadataInfo(ServiceInstanceMetadataUtils.getExportedServicesRevision(instance));
   ```
   
   @plusmancn for mark


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-899024310


   Good idea! Would you please describe more about this proposal?


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn edited a comment on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
plusmancn edited a comment on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-904750134


   > (因为 filter 总是覆盖而非追加)
   
   @JasonMing When I refer to the official docs, it says:
   > provider 和 service 同时配置的 filter 时,累加所有 filter,而不是覆盖。比如:<dubbo:provider filter="xxx,yyy"/> 和 <dubbo:service filter="aaa,bbb" />,则 xxx,yyy,aaa,bbb 均会生效。如果要覆盖,需配置:<dubbo:service filter="-xxx,-yyy,aaa,bbb" />
   
   and I have verified it by the following config,  `AFilter` was annotated by `@Activate`,  the `AFilter` didn't appear in RPC producer, but `BFilter` did as expected.  So maybe it's helpful for your confusion.
   ```xml
   
   <dubbo:consumer filter="-a"/> 
   <dubbo:reference filter="b"/>
   ```
   
   But I found another problem (See #8605) that we have no config option to control `AFilter` not appearing in the `getMetadataInfo` process.  
   ```java
   metadataInfo = metadataServiceProxy
              .getMetadataInfo(ServiceInstanceMetadataUtils.getExportedServicesRevision(instance));
   ```
   
   @plusmancn for mark


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] plusmancn edited a comment on issue #8470: 提供可控的 `Invoker` 链组装过程。

Posted by GitBox <gi...@apache.org>.
plusmancn edited a comment on issue #8470:
URL: https://github.com/apache/dubbo/issues/8470#issuecomment-904750134


   > (因为 filter 总是覆盖而非追加)
   
   @JasonMing When I refer to the official docs, it says:
   > provider 和 service 同时配置的 filter 时,累加所有 filter,而不是覆盖。比如:<dubbo:provider filter="xxx,yyy"/> 和 <dubbo:service filter="aaa,bbb" />,则 xxx,yyy,aaa,bbb 均会生效。如果要覆盖,需配置:<dubbo:service filter="-xxx,-yyy,aaa,bbb" />
   
   and I have verified it by the following config,  `AFilter` was annotated by `@Activate`,  the `AFilter` didn't appear in RPC producer, but `BFilter` did as expected.  So maybe it's helpful for your confusion.
   ```xml
   
   <dubbo:consumer filter="-a"/> 
   <dubbo:reference filter="b"/>
   ```
   
   But I found another problem that we have no config option to control `AFilter` not appaerning in `getMetadataInfo` process.
   ```java
   metadataInfo = metadataServiceProxy
              .getMetadataInfo(ServiceInstanceMetadataUtils.getExportedServicesRevision(instance));
   ```
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org