Skip to content
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

添加新服务上线通知的事件回调 #295

Open
ROMYIM opened this issue Jun 28, 2024 · 4 comments
Open

添加新服务上线通知的事件回调 #295

ROMYIM opened this issue Jun 28, 2024 · 4 comments

Comments

@ROMYIM
Copy link

ROMYIM commented Jun 28, 2024

Describe what happened (or what feature you want)

目前IEvent只有一个实现类InstancesChangeEvent,用于通知各客户端已知(已订阅过)的服务实例变化。
但是如果在组下有一个新的(新的ServiceName)服务添加上线,nacos并没有相应的事件通知。
这使得每个客户端需要做一个定时服务扫描nacos下的服务列表,然后和本地缓存作比较并需要重新刷新缓存。
这样导致新服务(新的ServiceName)上线不能及时同步到各客户端,还需要做一些定时任务白白浪费资源。

Describe what you expected to happen

有个一新的事件可以支持通知新服务(新的ServiceName)上线通知。
public class InstancesNewEvent(string groupName) : IEvent;
该事件可以针对某个组下。只要在这个组下首次出现新的服务(ServiceName)上线,就可以对某个组下订阅了这个事件的所有客户端发起广播通知

How to reproduce it (as minimally and precisely as possible)

Related code

public class InstancesNewEvent(string groupName) : IEvent
{
     public string GroupName => groupName;
     public string ServiceName  {get; set;}
     public List<Instance> Hosts { get; set; }
     public string Clusters { get; set; }
}
@liangdan862679370
Copy link

我的服务现在也会出现这个问题。突然间就断掉了。而且一直重连失败,要重启容器才行,不知道为什么。nacos-sdk包用的是1.3.5 这个问题最后你怎么解决的

@ROMYIM
Copy link
Author

ROMYIM commented Jul 12, 2024

我的服务现在也会出现这个问题。突然间就断掉了。而且一直重连失败,要重启容器才行,不知道为什么。nacos-sdk包用的是1.3.5 这个问题最后你怎么解决的

你回错issue了吧。我这是期望添加新功能,不是说连接问题。

@liangdan862679370
Copy link

liangdan862679370 commented Jul 12, 2024 via email

@catcherwong
Copy link
Collaborator

@ROMYIM 这个事件,nacos服务端貌似现在并不支持。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants