diff --git a/CHANGELOG-2.2.md b/CHANGELOG-2.2.md index 4a491ed2a..c43d10108 100644 --- a/CHANGELOG-2.2.md +++ b/CHANGELOG-2.2.md @@ -2,7 +2,7 @@ ## Fixed -- [#3872](https://github.com/hyperf/hyperf/pull/3872) Fixed bug that heartbeat failed when using nacos without default group. +- [#3872](https://github.com/hyperf/hyperf/pull/3872) [#3873](https://github.com/hyperf/hyperf/pull/3873) Fixed bug that heartbeat failed when using nacos without default group. - [#3879](https://github.com/hyperf/hyperf/pull/3879) Fixed bug that `watcher` does not work caused by proxies replaced. # v2.2.1 - 2021-07-27 diff --git a/src/service-governance-nacos/src/Listener/MainWorkerStartListener.php b/src/service-governance-nacos/src/Listener/MainWorkerStartListener.php index 23d831ae6..666ceffa4 100644 --- a/src/service-governance-nacos/src/Listener/MainWorkerStartListener.php +++ b/src/service-governance-nacos/src/Listener/MainWorkerStartListener.php @@ -105,7 +105,7 @@ class MainWorkerStartListener implements ListenerInterface // Register Instance to Nacos. $instanceConfig = $serviceConfig['instance'] ?? []; - $ephemeral = $instanceConfig['ephemeral'] ?? null; + $ephemeral = in_array($instanceConfig['ephemeral'], [true, 'true'], true) ? 'true' : 'false'; $cluster = $instanceConfig['cluster'] ?? null; $weight = $instanceConfig['weight'] ?? null; $metadata = $instanceConfig['metadata'] ?? null; diff --git a/src/service-governance-nacos/src/Process/InstanceBeatProcess.php b/src/service-governance-nacos/src/Process/InstanceBeatProcess.php index 7f87ad036..5da901b93 100644 --- a/src/service-governance-nacos/src/Process/InstanceBeatProcess.php +++ b/src/service-governance-nacos/src/Process/InstanceBeatProcess.php @@ -33,6 +33,7 @@ class InstanceBeatProcess extends AbstractProcess $serviceConfig = $config->get('nacos.service', []); $serviceName = $serviceConfig['service_name']; + $namespaceId = $serviceConfig['namespace_id']; $groupName = $serviceConfig['group_name'] ?? null; $instanceConfig = $serviceConfig['instance'] ?? []; $ephemeral = $instanceConfig['ephemeral'] ?? null; @@ -53,10 +54,12 @@ class InstanceBeatProcess extends AbstractProcess [ 'ip' => $ip, 'port' => $port, + 'serviceName' => $groupName . '@@' . $serviceName, 'cluster' => $cluster, 'weight' => $weight, ], $groupName, + $namespaceId, $ephemeral );