Closed shige8023 closed 5 years ago
dubbosetting配置了“group”信息后调用失败,导致我一度以为是我配置写错了,深入探究了该项目源码后,发现dubbo-url的from方法这里,取的“group”是“group”,然后查了dubbo的服务注册信息,发现group信息的配置为“default.group”,将dubbo-url的from方法改为如下,可以正常使用 class DubboUrl { constructor(providerUrl) { log('DubboUrl from -> %s', providerUrl); this._url = url_1.default.parse(providerUrl); this._query = querystring_1.default.parse(providerUrl); this.host = this._url.hostname; this.port = Number(this._url.port); this.path = this._url.pathname.substring(1); this.dubboVersion = this._query.dubbo || ''; this.version = this._query.version || this._query['default.version'] || '0.0.0'; this.group = this._query.group || this._query['default.group']|| ''; } static from(providerUrl) { return new DubboUrl(providerUrl); } }
class DubboUrl { constructor(providerUrl) { log('DubboUrl from -> %s', providerUrl); this._url = url_1.default.parse(providerUrl); this._query = querystring_1.default.parse(providerUrl); this.host = this._url.hostname; this.port = Number(this._url.port); this.path = this._url.pathname.substring(1); this.dubboVersion = this._query.dubbo || ''; this.version = this._query.version || this._query['default.version'] || '0.0.0'; this.group = this._query.group || this._query['default.group']|| ''; } static from(providerUrl) { return new DubboUrl(providerUrl); } }
fixed https://github.com/apache/dubbo-js/pull/138
dubbosetting配置了“group”信息后调用失败,导致我一度以为是我配置写错了,深入探究了该项目源码后,发现dubbo-url的from方法这里,取的“group”是“group”,然后查了dubbo的服务注册信息,发现group信息的配置为“default.group”,将dubbo-url的from方法改为如下,可以正常使用
class DubboUrl { constructor(providerUrl) { log('DubboUrl from -> %s', providerUrl); this._url = url_1.default.parse(providerUrl); this._query = querystring_1.default.parse(providerUrl); this.host = this._url.hostname; this.port = Number(this._url.port); this.path = this._url.pathname.substring(1); this.dubboVersion = this._query.dubbo || ''; this.version = this._query.version || this._query['default.version'] || '0.0.0'; this.group = this._query.group || this._query['default.group']|| ''; } static from(providerUrl) { return new DubboUrl(providerUrl); } }