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

Phoenix可以用来构建用状态的服务,那么关于服务状态的重建有什么较好的方案吗 #2

Open
gaoyanliang opened this issue Apr 10, 2020 · 1 comment

Comments

@gaoyanliang
Copy link
Member

对于有状态的服务,可能存在这样的需求。要求该服务每过一段时间(Days、Hours.....)重建一次服务的状态。

请问有什么较好的实现方案吗?

@shibd
Copy link
Member

shibd commented Apr 10, 2020

Phoenix对状态的管理是以聚合根为单位的,每一个聚合根都有唯一标识聚合根ID。Phoenix会自动从内存中淘汰不活跃的聚合根,配置为:

quantex.phoenix.server.performance.actor-survive-time= 86400000

单位为毫秒

所以,针对服务每过一段时间,重建服务状态。 可以让客户端在发送命令时,对聚合根加上时间维度单位,比如:id001-2020-02-03,再第二天时ID为id001-2020-02-04,发送的聚合根ID不一样,状态就是全新的。

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

2 participants