-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
camellia-delay-queue support use nacos as register center #198
Labels
Comments
请问现在的版本[1.2.28]有办法使用注册中心吗 |
当前支持eureka,其他注册中心需要简单开发一下 欢迎加入微信技术交流群 |
有示例吗? |
服务器注册: 客户端发现: 参考: public class EurekaDelayQueueServerDiscovery extends ReloadableCamelliaDiscovery<DelayQueueServer> implements DelayQueueServerDiscovery {
private final DiscoveryClient discoveryClient;
private final String applicationName;
public EurekaDelayQueueServerDiscovery(DiscoveryClient discoveryClient, String applicationName, int refreshIntervalSeconds) {
this.discoveryClient = discoveryClient;
this.applicationName = applicationName;
init(() -> new ArrayList<>(refreshProxySet()), refreshIntervalSeconds);
}
private Set<DelayQueueServer> refreshProxySet() {
List<ServiceInstance> instances = discoveryClient.getInstances(applicationName);
Set<DelayQueueServer> set = new HashSet<>();
for (ServiceInstance instance : instances) {
try {
if (instance instanceof EurekaDiscoveryClient.EurekaServiceInstance) {
InstanceInfo instanceInfo = ((EurekaDiscoveryClient.EurekaServiceInstance) instance).getInstanceInfo();
if (instanceInfo.getStatus() != InstanceInfo.InstanceStatus.UP) {
continue;
}
set.add(new DelayQueueServer("http://" + instanceInfo.getIPAddr() + ":" + instanceInfo.getPort()));
} else {
DelayQueueServer proxy = new DelayQueueServer("http://" + instance.getHost() + ":" + instance.getPort());
set.add(proxy);
}
} catch (Exception e) {
DelayQueueServer proxy = new DelayQueueServer("http://" + instance.getHost() + ":" + instance.getPort());
set.add(proxy);
}
}
return set;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Module: camellia-delay-queue
Content: support use nacos as register center
The text was updated successfully, but these errors were encountered: