This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 43299489a Fix the bug that the SC address is configured for automatic
discovery but cannot be automatically refreshed (#4807)
43299489a is described below
commit 43299489a147d33943b3310dea7f9fb970e5a329
Author: qlonglong <[email protected]>
AuthorDate: Wed May 7 17:48:16 2025 +0800
Fix the bug that the SC address is configured for automatic discovery but
cannot be automatically refreshed (#4807)
Subscribing to the `HeartBeatEvent` and publishing the `HeartBeatEvent` are
handled by two different event buses. Therefore, the `SCAddressManager` will
never receive the `HeartBeatEvent`. As a result, even if
`servicecomb.registry.sc.autodiscovery: true` is configured, the system will
not automatically refresh the SC address.
---
.../java/org/apache/servicecomb/registry/sc/SCAddressManager.java | 2 +-
.../main/java/org/apache/servicecomb/registry/sc/SCRegistration.java | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java
index c9bf300a3..c650d068b 100644
---
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java
+++
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java
@@ -63,7 +63,7 @@ public class SCAddressManager {
this.configurationProperties = configurationProperties;
this.serviceCenterClient = serviceCenterClient;
this.scRegistration = scRegistration;
- EventManager.getEventBus().register(this);
+ scRegistration.getEventBus().register(this);
}
@Subscribe
diff --git
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java
index a2a47ca5a..aba4d6d49 100644
---
a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java
+++
b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java
@@ -194,4 +194,8 @@ public class SCRegistration implements
Registration<SCRegistrationInstance> {
public MicroserviceInstance getBackendMicroserviceInstance() {
return microserviceInstance;
}
+
+ EventBus getEventBus() {
+ return eventBus;
+ }
}