Orleans框架简单示范

希望现在学习Orleans不会晚,毕竟Server Fabric都开源了。本篇博客从Sample的HelloWorld示例程序来解读Orleans的Grains。

Server配置参考 : https://dotnet.github.io/orleans/Documentation/clusters_and_clients/configuration_guide/server_configuration.html
Client配置参考 : https://dotnet.github.io/orleans/Documentation/clusters_and_clients/configuration_guide/client_configuration.html
对于客户端以及服务端的配置,建议配置上AddApplicationPart, 这样能够明确到Grain的类型及用途。

Grain的相关:
Grain的实现就不用说了.在这里要注意下Grain的持久化。参考 https://dotnet.github.io/orleans/Documentation/grains/grain_persistence/index.html

对于Grain的获取,我们在定义Grain接口类型的时候,会继承自:
IGrainWithStringKey、IGrainWithIntegerKey、IGrainWithGuidKey等接口,在这就指定了Grain的标志,我们定义了什么类型的Grain接口我们就使用什么类型去获取Grain. 参考: https://dotnet.github.io/orleans/Documentation/grains/grain_identity.html

示例代码:https://github.com/RyanOvO/Orleans-HelloWorld

主要的代码还是github上的,我只是完善了下Grain持久化那块。

原文地址:https://www.cnblogs.com/zhiyong-ITNote/p/10205558.html