ReactiveServices/ReactiveServices.Application

语言: C#

git: https://github.com/ReactiveServices/ReactiveServices.Application

反应服务框架
Reactive Services Framework
README.md (中文)

反应性服务

Reactive Services是一个框架,支持通过.NET / Mono框架开发分布式应用程序,遵循Reactive Manifesto的原则并为云分发做好准备。

有关框架的概述,请参阅此链接。

Build status

ReactiveServices.Application

ReactiveServices.Application是Reactive Services框架的主要包。

反应服务组件

该软件包提供以下组件:

  • ReactiveServices.Application.Bootstrap:此类用于引导您的应用程序。调用其静态Run()方法将加载Bootstrap.config文件并根据此文件中的配置初始化计算单元。 Dependencies.config文件也必须存在并用于通知系统如何解析其依赖关系,以及Settings.config文件,以便为系统提供任何自定义参数化,例如连接字符串。 NLog.config文件也应该存在,并将用于检测NLog框架中它将使用的参数化。
  • Reactive Services.Application.Coordinator:Boostrap类使用此类为您的计算单元实例化Supervisor并继续引导过程。
  • ReactiveServices.Application.Supervisor:此类负责监视给定Bootstrap.config文件的计算单元,并在它们看起来已关闭时恢复其执行。此过程也用于应用程序的初始引导程序。
  • ReactiveServices.Application.Bootstrapper:这是将执行给定Boostrap.config文件的实际引导程序的类。 Supervisor类也使用它来引导各个计算单元。
  • ReactiveServices.Application.DispatcherLauncher:Bootstrapper类使用此类来执行单个计算单元的启动。 InProcessDispatcherLauncher版本也可用,可以使用Dependencies.config文件进行配置,并允许在进行调用的进程内引导整个Dispatchers,而无需启动任何ComputationalUnit.exe进程。在这种情况下,调用进程将作为所有已配置工作程序的单个计算单元。
  • ReactiveServices.ComputationalUnit.Dispatching.Dispatcher:此类是在ComputationalUnit.exe进程内执行的主要服务。它负责从消息总线接收作业请求,根据Bootstrap.config文件中的配置实例化相应的worker,并将作业执行分派给这些worker,并监视它们的生命周期。
  • ComputationalUnit.exe:该程序将托管将组成您的应用程序的工作集(或子集)。可以单独配置此程序的多个实例,以允许您的应用程序根据您的需要进行扩展。
  • ReactiveServices.ComputationalUnit.Work.Worker:此类必须用作任何工作人员的基类,并且开发人员必须使用必须实现的抽象方法,以允许完成工作程序的整个生命周期。
  • ReactiveServices.ComputationalUnit.Work.Job:此类必须用作将在消息总线中发布并由相应工作程序执行的作业请求的基类。

怎么运行的?

发布作业请求

作业请求是从ReactiveServices.ComputationalUnit.Work.Job类派生的任何类。它必须使用[DataContract]和[DataMember]属性进行注释,并且必须在名为JobClassFullName:JobClassAssembly的交换中的消息总线上发布,并且路由键处于挂起状态。必须在承载相应工作程序的计算单元运行后执行此发布。

执行一份工作

发布后,调度程序将收到作业请求并发送给相应的工作人员。必须在Bootstrap.config文件中配置此作业/工作者通信。 发送作业请求的工作人员将执行作业并在结束时发布一些事件。如果发生故障,Dispatcher可能会尝试根据配置重复执行。在整个计算单元崩溃的情况下,作业请求将作为未决请求返回到消息总线,并且可以由被配置为托管相同类型的工作者的另一计算单元接收。

与消息总线交谈

必须使用ReactiveServices.MessageBus包执行从消息总线发布或接收消息的任何过程。有关更多详细信息,请参阅包文档。

执照

带许可证

版本

SemVer 2.0

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Reactive Services

Reactive Services is a framework that support the development of distributed applications over the .NET/Mono frameworks, following the principles of the Reactive Manifesto and ready for cloud distribution.

See this link for an overview about the framework.

Build status

ReactiveServices.Application

ReactiveServices.Application is the main package of the Reactive Services framework.

Reactive Services Components

This package provides the following components:

  • ReactiveServices.Application.Bootstrap: This class is used to bootstrap your application. Calling its static Run() method will load the Bootstrap.config file and initialize the computational units according to the configuration found in this file. A Dependencies.config file must also exist and be used to inform the system how to resolve its dependencies, as well as a Settings.configfile, to give to the system any custom parameterization, such as connections string, for example. A NLog.config file shall also be present and will be used to instrument the NLog framework about the parameterization it shall use.
  • ReactiveServices.Application.Coordinator: This class is used by the Boostrap class to instanciate a Supervisor for your computational units and continue with the bootstrap process.
  • ReactiveServices.Application.Supervisor: This class is responsible for supervising the computational units of a given Bootstrap.config file and restore their execution if they seem to be down. This process is also used for the initial bootstrap of the application.
  • ReactiveServices.Application.Bootstrapper: This is the class that will perform the actual bootstrap of a given Boostrap.config file. It is used by the Supervisor class also to bootstrap individual computational units.
  • ReactiveServices.Application.DispatcherLauncher: This class is used by the Bootstrapper class to perform the launch of a single computational unit. An InProcessDispatcherLauncher version is also available and can be configured using the Dependencies.config file and will allow the bootstrap of the entire set of Dispatchers inside the process that makes the call, without launching any ComputationalUnit.exe process. In this case, the calling process will act as a single computational unit for all configured workers.
  • ReactiveServices.ComputationalUnit.Dispatching.Dispatcher: This class is the main service executed inside a ComputationalUnit.exe process. It is responsible for receiving the job requests from the message bus, instanciate the corresponding workers, according to the configuration in the Bootstrap.config file and dispatch the job execution to such workers, as well as monitor their lifecycle.
  • ComputationalUnit.exe: This program will host the set (or a subset) of workers that will compose your application. Multiple instances of this program can be configured independently to allow your application to scale according to your needs.
  • ReactiveServices.ComputationalUnit.Work.Worker: This class must be used as base class for any worker and instrument the developer with the abstract methods that must be implemented to allow the full lifecycle of the worker to be completed.
  • ReactiveServices.ComputationalUnit.Work.Job: This class must be used as base class for the job requests that will be published in the message bus and executed by the corresponding worker.

How it works?

Publishing a job request

A job request is any class derived from the ReactiveServices.ComputationalUnit.Work.Job class. It must be annotated with the [DataContract] and [DataMember] attributes and must be published on the message bus in an exchange named JobClassFullName:JobClassAssembly with the routing key pending. This publication must be performed after the computational unit that hosts the corresponding worker be running.

Executing a job

Once published, the job request will be received by the Dispatcher and dispatched to the corresponding worker. This job/worker correspondence must be configured in the Bootstrap.config file.
The worker which the job request was dispatched to will execute the job and publish some events upon its conclusion. In case of a failure, the Dispatcher may try to repeat the execution, according to the configuration. In case the whole computational unit crashes, the job request will return to the message bus as a pending request and can be received by another computational unit configured to host the same kind of worker.

Talking to the Message Bus

Any process of publish or receive a message from the Message Bus must be performed using the ReactiveServices.MessageBus package. See the package documentation for more details.

License

MIT License

Versioning

SemVer 2.0