diff --git a/.gitignore b/.gitignore index c7587af..1214642 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,7 @@ typings/ run test/fixtures/apps/**/proxy test/fixtures/apps/**/proxy_class +test/fixtures/apps/**/src +test/fixtures/apps/**/pom.xml +test/fixtures/apps/**/target/ +test/fixtures/apps/**/config/apiMeta.json diff --git a/.travis.yml b/.travis.yml index 4c6e37d..d29216c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,15 @@ before_install: - './zookeeper-3.4.6/bin/zkServer.sh start' - echo $JAVA_HOME - java -version - - 'wget https://github.com/alibaba/nacos/releases/download/0.5.0/nacos-server-0.5.0.tar.gz' - - 'wget https://github.com/gxcsoccer/PDisk/releases/download/1.0.0/startup.sh' - - 'tar xf nacos-server-0.5.0.tar.gz' + - 'wget https://github.com/alibaba/nacos/releases/download/1.0.0/nacos-server-1.0.0.tar.gz' + - 'wget https://github.com/gxcsoccer/PDisk/releases/download/1.0.1/startup.sh' + - 'tar xf nacos-server-1.0.0.tar.gz' - 'mv ./startup.sh ./nacos/bin/startup.sh' - 'chmod 755 ./nacos/bin/startup.sh' - 'nohup ./nacos/bin/startup.sh -m standalone 2>&1 &' - 'sleep 30' - - 'curl "127.0.0.1:8848/nacos/v1/ns/api/hello"' + - 'cat nohup.out' + - 'curl "127.0.0.1:8848/nacos/v1/ns/operator/metrics"' install: - npm i script: diff --git a/lib/registry/nacos.js b/lib/registry/nacos.js index 8778ec1..fed2fb8 100644 --- a/lib/registry/nacos.js +++ b/lib/registry/nacos.js @@ -73,12 +73,18 @@ class NacosRegistryClient extends SdkBase { assert(config.url, '[NacosRegistry] register(config) config.url is required'); const serviceName = this._buildProviderPath(config); const url = new URL(config.url); - await this._client.deregisterInstance(serviceName, url.hostname, Number(url.port)); + await this._client.deregisterInstance(serviceName, { + ip: url.hostname, + port: Number(url.port), + }); } async _doSubscribe(consumerKey, config) { this._subscribeMap.set(consumerKey, null); - await this._client.registerInstance(consumerKey, localIp, 0); + await this._client.registerInstance(consumerKey, { + ip: localIp, + port: 0, + }); const providerKey = this._buildProviderPath(config); this._client.subscribe(providerKey, hosts => { const addressList = hosts.filter(host => host.enabled).map(host => { @@ -145,8 +151,8 @@ class NacosRegistryClient extends SdkBase { return serviceName; } - close() { - this._client.close(); + async _close() { + await this._client.close(); this._subscribeMap.clear(); } } diff --git a/package.json b/package.json index b9633e3..02ec574 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "egg-rpc-for-apache-dubbo", - "version": "1.0.0", + "name": "egg-dubbo-rpc", + "version": "1.1.0", "description": "dubbo rpc plugin for egg", "eggPlugin": { "name": "dubboRpc", @@ -16,20 +16,20 @@ "dependencies": { "address": "^1.1.0", "js-remoting-for-apache-dubbo": "^1.0.0", - "nacos": "^1.1.2", + "nacos": "^2.0.0", "sdk-base": "^3.6.0", "sofa-rpc-node": "^1.12.0" }, "devDependencies": { "autod": "^3.1.0", "autod-egg": "^1.1.0", - "egg": "^2.21.1", + "egg": "^2.22.2", "egg-bin": "^4.13.0", - "egg-mock": "^3.22.2", + "egg-mock": "^3.22.4", "egg-rpc-base": "^1.3.1", "egg-rpc-generator": "^1.3.1", "eslint": "^5.16.0", - "eslint-config-egg": "^7.3.1", + "eslint-config-egg": "^7.4.1", "mz-modules": "^2.1.0", "webstorm-disable-index": "^1.2.0", "zookeeper-cluster-client": "^3.0.0"