<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 服務注冊 在前面的章節我們分析過 Go Micro 的實現原理,服務注冊在微服務中的作用主要是實現動態的負載均衡,現在流行的服務注冊中間件有 Consul、Etcd 等,其中 Etcd 是 k8s 的核心組件,社區非常活躍,使用非常簡單且 Watch/KeepAlive 功能更加友好,因此 Mix 選擇 Etcd 作為與 Go Micro 互通,后續再推出 Consul 的支持。 ## Mix Micro Etcd >[info] 需先安裝 Etcd V3 使用 [composer](https://www.phpcomposer.com/) 安裝: ``` composer require mix/micro-etcd ``` ## 依賴注入配置 - [manifest/beans/etcd.php](https://github.com/mix-php/mix-micro-skeleton/blob/master/manifest/beans/etcd.php) ## 服務注冊 - ServiceFactory::class 提供了從 Mix Http Server / Route 中提取服務信息的功能,提取后 register 到注冊中心即可。 ~~~ $registry = new \Mix\Micro\Etcd\Registry('http://127.0.0.1:2379/v3', $user, $password, $timeout); $serviceFactory = new ServiceFactory(); $services = $serviceFactory->createServiceFromAPI( $server, $route, 'php.micro.api' ); $registry->register(...$services); ~~~ - 查看 API 注冊實例: [StartCommand.php#L103](https://github.com/mix-php/mix-micro-skeleton/blob/master/app/Api/Commands/StartCommand.php#L103) - 查看 gRPC 注冊實例: [StartCommand.php#L95](https://github.com/mix-php/mix-micro-skeleton/blob/master/app/Grpc/Commands/StartCommand.php#L95) ## 服務獲取 Mix 的 gRPC、JSON-RPC 客戶端撥號器中只需傳入上面的注冊中心,就自動完成對應微服務的獲取: - 服務中心的依賴配置:[manifest/beans/etcd.php#L5](https://github.com/mix-php/mix-micro-skeleton/blob/master/manifest/beans/etcd.php#L5) - 撥號器的依賴配置:[manifest/beans/grpc.php#L11](https://github.com/mix-php/mix-micro-skeleton/blob/master/manifest/beans/grpc.php#L11) - 通過撥號器調用微服務:[SayController.php#L54](https://github.com/mix-php/mix-micro-skeleton/blob/master/app/Api/Controllers/Greeter/SayController.php#L54)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看