feat: finish nacos basic process
diff --git a/examples/hello-midway/src/app.ts b/examples/hello-midway/src/app.ts
index f5e9a8d..ebc7ad9 100644
--- a/examples/hello-midway/src/app.ts
+++ b/examples/hello-midway/src/app.ts
@@ -19,11 +19,9 @@
 import dubbo from './app/dubbo';
 
 export default async (app: Application) => {
-  app.beforeStart(async () => {
-    console.log('🚀 Your awesome APP is launching...');
-    await dubbo(app);
-    await app.dubbo.ready();
-    console.log('dubbo was ready..');
-    console.log('✅  Your awesome APP launched');
-  });
+  console.log('🚀 Your awesome APP is launching...');
+  await dubbo(app);
+  await app.dubbo.ready();
+  console.log('dubbo was ready..');
+  console.log('✅  Your awesome APP launched');
 };
diff --git a/examples/hello-midway/src/config/config.default.ts b/examples/hello-midway/src/config/config.default.ts
index 8bc7c0b..90dfc8d 100644
--- a/examples/hello-midway/src/config/config.default.ts
+++ b/examples/hello-midway/src/config/config.default.ts
@@ -30,8 +30,10 @@
 
   config.dubbo = {
     application: 'hello-midway',
-    register: 'localhost:2181,localhost:2182,localhost:2183',
-    // register: 'nacos://localhost:8848',
+    // zookeeper 的链接
+    // register: 'localhost:2181,localhost:2182,localhost:2183',
+    // nacos 的链接 要以 nacos:// 开头
+    register: 'nacos://localhost:8848',
   };
 
   return config;
diff --git a/packages/dubbo/src/consumer/dubbo.ts b/packages/dubbo/src/consumer/dubbo.ts
index f88fe1c..d4c6ec6 100644
--- a/packages/dubbo/src/consumer/dubbo.ts
+++ b/packages/dubbo/src/consumer/dubbo.ts
@@ -245,7 +245,6 @@
    * 其他的框架类似
    */
   ready() {
-    console.log('9---------------');
     return this._readyPromise;
   }
 
diff --git a/packages/dubbo/src/registry/nacos.ts b/packages/dubbo/src/registry/nacos.ts
index d7841f5..bcc40b1 100644
--- a/packages/dubbo/src/registry/nacos.ts
+++ b/packages/dubbo/src/registry/nacos.ts
@@ -16,7 +16,6 @@
  */
 
 import debug from 'debug';
-// import { go } from '../common/go';
 import {traceErr} from '../common/util';
 import {
   IDubboConsumerRegistryProps,
@@ -26,46 +25,41 @@
 import Registry from './registry';
 
 const NacosNamingClient = require('nacos').NacosNamingClient;
-// const NacosNamingClient = require('nacos')
+// nacos debug
 const log = debug('dubbo:nacos');
 export class Nacos extends Registry<
   IDubboConsumerRegistryProps | IDubboProviderRegistryProps
 > {
   constructor(
     nacosProps: INaocsClientProps,
-    dubboProp: IDubboConsumerRegistryProps | IDubboProviderRegistryProps,
+    dubboProps: IDubboConsumerRegistryProps | IDubboProviderRegistryProps,
   ) {
-    super(dubboProp);
+    super(dubboProps);
     this._nacosProps = nacosProps;
-    log(`new:|> %O`, {...this._nacosProps, ...dubboProp});
+    log(`new:|> %O`, {...this._nacosProps, ...dubboProps});
     this._nacosProps.nacosRoot = this._nacosProps.nacosRoot || 'dubbo';
-    // 初始化nacos的client
+    // init nacos client
     this._connect(this._init);
   }
-  // nacos 属性
+  // nacos props
   private _nacosProps: INaocsClientProps;
   private _client: any;
 
-  // nacos 连接
-  private async _connect(callback: (err: Error) => void) {
+  // nacos connect
+  private _connect = async (callback: (err: Error) => void) => {
     const {url: register} = this._nacosProps;
     let u = register.split('nacos://')[1];
     log(`connecting nacosserver ${u}`);
-
     this._client = new NacosNamingClient({
       logger: console,
       serverList: u,
       namespace: 'public',
     });
-    // const serviceName = 'providers:org.apache.dubbo.demo.DemoProvider:1.0.0:';
-    // const hosts = await this._client.getAllInstances(serviceName);
-    // const status = await this._client.getServerStatus();
-    // console.log('0--------------------', hosts);
-    // console.log('1--------------------', status);
-  }
+    this._client.ready();
+    callback(null);
+  };
 
-  private async _init(err: Error) {
-    log(`88888888-------`);
+  private _init = async (err: Error) => {
     // nacos occur error
     if (err) {
       log(err);
@@ -74,67 +68,44 @@
       return;
     }
 
+    // if current nacos call from dubbo provider, registry provider service to nacos
     if (this._dubboProps.type === 'provider') {
       log(`this._dubboProps.type=${this._dubboProps.type}`);
       return;
     }
 
     // nacos connected
-    const {nacosRoot} = this._nacosProps;
-    const {
-      application: {name},
-      interfaces,
-    } = this._dubboProps;
+    let {interfaces, dubboSetting} = this._dubboProps;
 
     log(`this._dubboProps=${this._dubboProps}`);
 
-    //获取所有 provider
-    for (let inf of interfaces) {
-      // 当前接口在 nacos 中的路径
-      const dubboServicePath = `/${nacosRoot}/${inf}/providers`;
-      log(`dubboServicePath=${dubboServicePath}`);
-      // 当前接口路径下的 dubbo url
-      // const {res: dubboServiceUrls, err} = await go(
-      //   this._getDubboServiceUrls(dubboServicePath, inf),
-      // );
-
-      // 重连进入init后不能清空已有provider, 会导致运行中的请求找到, 报no agents错误
-      // 或者zk出现出错了, 无法获取provider, 那么之前获取的还能继续使用
-      if (err) {
-        log(`getChildren ${dubboServicePath} error ${err}`);
-        traceErr(err);
-        //If an error occurs, continue
-        continue;
-      }
-
+    // 获取所有 provider
+    for (let item of interfaces) {
+      let obj = await dubboSetting.getDubboSetting(item);
+      // providers:org.apache.dubbo.demo.DemoProvider:1.0.0:
+      let inf = 'providers:' + item + ':' + obj.version + ':';
+      const dubboServiceUrls = await this._client.getAllInstances(inf);
       // set dubbo interface meta info
-      // this._dubboServiceUrlMap.set(inf, dubboServiceUrls.map(DubboUrl.from));
-
-      //写入 consumer 信息
-      // this._createConsumer({
-      //   name: name,
-      //   dubboInterface: inf,
-      // }).then(() => log('create Consumer finish'));
+      for (let {ip, port, metadata} of dubboServiceUrls) {
+        this._dubboServiceUrlMap.set(metadata.path, {...metadata, ip, port});
+      }
     }
+    log(`this._dubboServiceUrlMap=${this._dubboServiceUrlMap}`);
     this._subscriber.onData(this._allAgentAddrSet);
-  }
+  };
 
   /**
-   * 获取所有的负载列表,通过agentAddrMap聚合出来
-   * 这样有点Reactive的感觉,不需要考虑当中增加删除的动作
+   * 获取所有的负载列表,通过 agentAddrMap 聚合出来
    */
   private get _allAgentAddrSet() {
     const agentSet = new Set() as Set<string>;
-    for (let urlList of this._dubboServiceUrlMap.values()) {
-      for (let url of urlList) {
-        agentSet.add(url.host + ':' + url.port);
-      }
+    for (let metaData of (this._dubboServiceUrlMap as any).values()) {
+      agentSet.add(metaData.ip + ':' + metaData.port);
     }
     return agentSet;
   }
 }
 
-// nacos属性 dubbo属性
 export default function nacos(props: INaocsClientProps) {
   return (
     dubboProps: IDubboProviderRegistryProps | IDubboConsumerRegistryProps,
diff --git a/packages/dubbo/src/registry/registry.ts b/packages/dubbo/src/registry/registry.ts
index 2b68fc2..fedac6c 100644
--- a/packages/dubbo/src/registry/registry.ts
+++ b/packages/dubbo/src/registry/registry.ts
@@ -18,7 +18,7 @@
 import {noop} from '../common/util';
 import Context from '../consumer/context';
 import DubboUrl from '../consumer/dubbo-url';
-import {IRegistrySubscriber} from '../types';
+import {INacosMetaData, IRegistrySubscriber} from '../types';
 
 export type TAgentAddr = string;
 export type TDubboInterface = string;
@@ -29,7 +29,10 @@
 export default class Registry<T = {}> {
   protected _dubboProps: T;
   protected _subscriber: IRegistrySubscriber;
-  protected readonly _dubboServiceUrlMap: Map<TDubboInterface, Array<DubboUrl>>;
+  protected readonly _dubboServiceUrlMap: Map<
+    TDubboInterface,
+    Array<DubboUrl> | Array<INacosMetaData>
+  >;
 
   constructor(props: T) {
     this._dubboProps = props;
diff --git a/packages/dubbo/src/registry/zookeeper.ts b/packages/dubbo/src/registry/zookeeper.ts
index 08c1b38..6e7a84d 100644
--- a/packages/dubbo/src/registry/zookeeper.ts
+++ b/packages/dubbo/src/registry/zookeeper.ts
@@ -82,6 +82,8 @@
       interfaces,
     } = this._dubboProps;
 
+    log(`this._dubboProps=${this._dubboProps.interfaces}`);
+
     //获取所有provider
     for (let inf of interfaces) {
       //当前接口在zookeeper中的路径
diff --git a/packages/dubbo/src/types.ts b/packages/dubbo/src/types.ts
index 85d3ac9..e85614c 100644
--- a/packages/dubbo/src/types.ts
+++ b/packages/dubbo/src/types.ts
@@ -138,6 +138,28 @@
   url: string;
 }
 
+export interface INacosMetaData {
+  side?: string;
+  methods?: string;
+  release?: string;
+  deprecated?: string;
+  dubbo?: string;
+  pid?: string;
+  interface?: string;
+  version?: string;
+  generic?: string;
+  timeout?: string;
+  revision?: string;
+  path?: string;
+  protocol?: string;
+  application?: string;
+  dynamic?: string;
+  category?: string;
+  anyhost?: string;
+  ip: string;
+  port: number;
+}
+
 export interface IProviderProps {
   host: string;
   port: number;