Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.x泛化调用: 客户端异步功能无法兼容低版本 #6604

Closed
2 tasks done
chpengzh opened this issue Aug 15, 2020 · 1 comment
Closed
2 tasks done

2.7.x泛化调用: 客户端异步功能无法兼容低版本 #6604

chpengzh opened this issue Aug 15, 2020 · 1 comment

Comments

@chpengzh
Copy link

chpengzh commented Aug 15, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.6
  • Operating System version: linux,macos
  • Java version: 1.8

Steps to reproduce this issue

  1. 使用2.5.6版本发布dubbo服务
  2. 依照CompletableFuture<T> support for GenericService. #3163 功能进行泛化调用,声明客户端异步化调用
  3. Future 返回值中报错如下(method '$invokeAsync' not found),错误来源于服务端;
Failed to invoke remote proxy method $invokeAsync to registry://10.179.84.162:2181/com.alibaba.dubbo.registry.RegistryService?application=htw-facade&application.name=htw-facade&dubbo=2.5.3-didi-24&export=dubbo%3A%2F%2F10.179.25.19%3A7778%2Fcom.d.h.f.a.s.F*Service%3Fanyhost%3Dtrue%26application%3Dh-f%26application.name%3Dh-f%26default.service.filter%3DBhBizProviderFilter%2CBhDLProviderFilter%2CBhMetricsProviderFilter%2CDubboProviderContextSwitchFilter%26default.threads%3D500%26default.token%3Dtrue%26dispatcher%3Dmessage%26dubbo%3D2.5.3-didi-24%26interface%3Dcom.d.h.f.a.s.F*Service%26methods%3DoutAuthAndSendVoucher%2CqueryCardRemainInfo%2ChealthData%2CgetCityConfigControlResult%2CgetTripEndPopResult%2CactivityConfig%2CqrCodeUrlAnalyze%2CoutAuthCheck%2CfindTripEndPopResult%26owner%3D*%26pid%3D34411%26revision%3D1.0.2%26side%3Dprovider%26threadname%3DnonCoreFacadeProvider%26threads%3D100%26timestamp%3D1597290687001%26version%3D1.0.0_stable&file=/h/x/h/dubboLocal.cache&owner=*&pid=34411&registry=zookeeper&timestamp=1597290687000, cause: Not found method \"$invokeAsync\" in class com.d.h.f.a.s.F*Service.

创建 ReferenceConfig 和调用相关代码

@Service
public class DubboGenericIntegrationServiceImpl implements DubboGenericIntegrationService {

    @Resource
    private ApplicationConfig applicationConfig;

    @Resource
    private List<RegistryConfig> registryConfigs;

    @Resource
    private ConsumerConfig consumerConfig;

    @Nonnull
    @Override
    public ReferenceConfig<GenericService> createReference(
            @Nonnull String serviceName,
            @Nonnull String version,
            boolean async
    ) {
        ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
        reference.setInterface(serviceName);
        reference.setVersion(version);
        reference.setGeneric(Boolean.TRUE.toString());
        reference.setCheck(false);
        reference.setAsync(async);

        reference.setApplication(applicationConfig);
        reference.setRegistries(registryConfigs);
        reference.setConsumer(consumerConfig);
        return reference;
    }

    @Override
    public Object invokeSync(
            @Nonnull GenericService service,
            @Nonnull ProxyInvokeParam param
    ) {
        return service.$invoke(param.getMethod(), param.getParamTypes(), param.getParams());
    }

    @Override
    public CompletableFuture<Object> invokeASync(
            @Nonnull GenericService service,
            @Nonnull ProxyInvokeParam param
    ) {
        return service.$invokeAsync(param.getMethod(), param.getParamTypes(), param.getParams());
    }
}
@AlbumenJ
Copy link
Member

For lower version is not support async generic call. It is impossible to make it work if consumer or provider not support it. Please try upgrade your provider version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants