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

集成 sofa-rpc-node 时,直连服务是可以的,但是通过注册中心就不成功了 #5

Closed
JimmyDaddy opened this issue Oct 17, 2018 · 2 comments

Comments

@JimmyDaddy
Copy link

JimmyDaddy commented Oct 17, 2018

  • 集成 sofa-rpc-node 时,AddressGroup 的 addressList 为空
// sofa-rpc-node/lib/client/consumer.js 中

  async _init() {
    this._addressGroup = this.createAddressGroup(this.id + '@' + this.group);
    if (this.options.serverHost) {
      const addressList = this.options.serverHost.split(',').map(url => this.parseUrl(url));
      setImmediate(() => { this._addressGroup.addressList = addressList; });
    } else {
      await this.registry.ready();
      this._addressGroup = this.createAddressGroup(this.id + '@' + this.group);
      this._addressListener = addressList => {
// addressList 为 []
        this._addressGroup.addressList = addressList.map(url => this.parseUrl(url));
      };
      this.registry.subscribe(this.registryConfig, this._addressListener);
    }
    await this._addressGroup.ready();
  }

  • 上述原因导致 invoke 时 执行
async getConnection(req) {
    return await this._addressGroup.getConnection(req);
  }

时返回 null

想知道为什么 addressList 为空?

集成 dubbo 时,直连服务是可以的,但是通过注册中心就不成功了

还有 group 的设置貌似不成功,直连的时候我需要将 group 名字写在 interfaceName 里面才行,单独配置 group 或者在初始化 client 时设置 group 都不成功

@gxcsoccer
Copy link
Member

#6

@gxcsoccer
Copy link
Member

重复 sofastack/sofa-rpc-node#15

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