简体   繁体   English

Amazon SWF入门-如何开始执行一个工作流程循环

[英]Amazon SWF Beginner- how to start execution of one workflow loop

I was looking through the samples available for Amazon SWF with Flow Framework (ie Java)-- in the samples I noticed that there is one class with a "main" that initiates workflow execution- there are also other similar classes with "main" that initiate workflow worker and activity worker (ie Workflow host and Activity Host). 我正在浏览适用于带Flow Framework(即Java)的Amazon SWF的示例-在示例中,我注意到有一个类带有“主”类来启动工作流执行-还有其他类似的类具有“主”类,它们可以启动工作流执行启动工作流程工作人员和活动工作人员(即工作流程主持人和活动主持人)。

Does this mean that to run a workflow, I have to put the execution code of all 3 classes into my void main? 这是否意味着要运行工作流程,我必须将所有3个类的执行代码放入我的void main中? Ie do I have to initiate the workflow host, activity host and start the workflow myself? 即我是否必须启动工作流程宿主,活动宿主并自己启动工作流程? Or do I just have to define WorkFlow Host and Activity Host classes in specified format, and then just initiate the workflow using Workflow client factory? 还是只需要以指定的格式定义WorkFlow Host和Activity Host类,然后使用Workflow Client Factory启动工作流?

There are three components in a SWF workflow - Worker, Activity and Client. SWF工作流程中包含三个组件-工作者,活动和客户端。 Workflow host class initiates workflow workers, while activity host initiates activity workers. 工作流程主持人类启动工作流程工作者,而活动主持人启动活动工作者。 Workflow and Activity workers must always be up and running to work on the various workflow tasks. 工作流程和活动工作人员必须始终启动并运行,以处理各种工作流程任务。 For this reason you have to include these classes in your void main . 因此,您必须在void main包括这些类。

Client (using workflow client factory) can make a request to start a workflow whenever it needs to. 客户端(使用工作流客户端工厂)可以在需要时发出启动工作流的请求。

Examples, for simplicity might have included all three classes in same main method, but ideally Client should be part of different application/main which can make call to start/end workflow whenever it wants, while activities and workers should run continuously. 为简单起见,示例可能将所有三个类都包含在同一main方法中,但理想情况下,Client应该属于不同应用程序/ main的一部分,该应用程序/ main可以在需要时调用开始/结束工作流,而活动和工作程序应连续运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM