工作流引擎如何接收外部事件?
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
ExternalDataExchangeService dataExchangeService;
dataExchangeService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataExchangeService);
PaymentProcessingService paymentProcessing;
paymentProcessing = new PaymentProcessingService();
dataExchangeService.AddService(paymentProcessing);
通过上面的代码,我们的应用程序可以使用 paymentProcessing.RaiseXXXXEvent 与工作流实例进行交互。我的问题是:实现这样一个机制的原则是什么?我认为这是一种事件驱动模式,但是我如何实现这种机制以及为什么?请给我指出方向或任何参考资料。
顺便问一下,jBPM中有这个机制吗? jBPM是否包括像窗口工作流基础那样的序列工作流和状态机工作流?
谢谢 !
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
ExternalDataExchangeService dataExchangeService;
dataExchangeService = new ExternalDataExchangeService();
workflowRuntime.AddService(dataExchangeService);
PaymentProcessingService paymentProcessing;
paymentProcessing = new PaymentProcessingService();
dataExchangeService.AddService(paymentProcessing);
With the code above, our application can use paymentProcessing.RaiseXXXXEvent to interactive with the workflow instance. My question is : What's the principle to implement such a mechanism. I think this is a kind of Event Driven Pattern, but how can I implement this mechanism and why ? Please point me the direction or any references are appreciated.
By the way, is there the mechanism in jBPM ? Does jBPM include sequence workflow and state machine workflow like window workflow foundation ?
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WF定义了一组核心工作流服务,处理线程调度、工作流
持久性、事务和工作流跟踪。 WF 的设计者可以嵌入
这些服务的实现在运行时引擎本身中,但他们明智地选择外部化
他们将其实现放置在可插入服务中。这让您处于掌控之中。你决定
使用哪些服务(有些是可选的)以及每个服务使用哪个实现。
WF 还支持另一种服务,称为本地服务(有时称为数据服务)
兑换服务)。这是您自己设计和实施的服务。本地服务可以提供服务
几乎任何目的,但一个一般用途是促进工作流实例之间的通信
和主机应用程序。与此相反,每个核心工作流服务都有一个目的(例如,
持久性、跟踪)已由 Microsoft 定义。您可以开发替代实现
对于每个核心服务,但这不会改变其定义的目的。
让您的本地服务可用于您的工作流程实例。有几种方法可以做到这一点。最简单的方法是使用 CallExternalMethodActivity 并对其进行配置。
该服务还应该有一个接口并用 [ExternalDataExchange] 装饰。
如果您正在考虑编写自己的核心服务实现,这里有一个链接,描述如何提供您自己的核心工作流服务。
http://msdn.microsoft.com/en -us/library/ms734705(v=VS.90).aspx
WF defines a set of core workflow services that handle thread scheduling, workflow
persistence, transactions, and workflow tracking. The designers of WF could have embedded
the implementation of these services in the runtime engine itself, but they wisely chose to externalize
them, placing their implementations in pluggable services. This places you in control. You decide
which services to use (some are optional) and which implementation to use for each service.
WF also supports another kind of service known as a local service (sometimes called a data
exchange service). This is a service that you design and implement yourself. A local service can serve
just about any purpose, but one general use is to facilitate communications between workflow instances
and the host application. In contrast with this, core workflow services each have a purpose (for example,
persistence, tracking) that has been defined by Microsoft. You can develop alternate implementations
for each core service, but that doesn’t change their defined purpose.
To have your local service available to your workflow instance. There are several methods to do this. The simplest would be to use the CallExternalMethodActivity and configure it.
Also the service should have an interface and decorated with [ExternalDataExchange].
If you are looking at writing your own implementation of a core service, here is a link that describe how to provide your own core workflow service.
http://msdn.microsoft.com/en-us/library/ms734705(v=VS.90).aspx