活动的单独任务列表 - AWS SWF

Posted

技术标签:

【中文标题】活动的单独任务列表 - AWS SWF【英文标题】:Separate Task Lists for Activities - AWS SWF 【发布时间】:2014-09-04 11:14:49 【问题描述】:

我有一个用例,我希望系统中有 10 个工作线程。其中,6 个工作线程应该轮询一个任务列表,4 个工作线程应该轮询另一个任务列表。

我在 Flow Framework 上以这种方式配置了我的代码。

我的一项活动已注册到不同的任务列表。所有其他活动到默认任务列表。我有 6 个工作线程正在侦听默认任务列表,其余四个正在侦听其他任务列表。

但是当我执行我的工作流程时,我得到了错误:

任务列表名称:CIMSProposalActivityValidationTList

身份:29547@ccs-master-1001.vdc.xyz.com

详细信息:["java.lang.IllegalStateException","cause":null,"stackTrace":["methodName":"current","fileName":"AsyncContextBase.java ","lineNumber":27,"className":"com.amazonaws.services.simpleworkflow.flow.core.AsyncContextBase","nativeMethod":false,"methodName":"","fileName":"AsyncContextBase. java","lineNumber":49,"className":"com.amazonaws.services.simpleworkflow.flow.core.AsyncContextBase","nativeMethod":false,"methodName":"","fileName":"TryCatchFinallyContext .java","lineNumber":46,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatchFinallyContext","nativeMethod":false,"methodName":"","fileName":" TryCatchFinally.java","lineNumber":233,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatchFinally","nativeMethod":false,"methodName":"","fileName": "TryCatch.java","lineNumber":22,"className":"com.amazonaws.services.simpleworkflow.flow.core.TryCatch","nativeMethod":false,"methodName":"","fileName" :"GrooveScheduleAspect.java","lin eNumber":93,"className":"com.amazon.transportation.groove.aspectj.GrooveScheduleAspect$1","nativeMethod":false,"methodName":"processGrooveSchedule","fileName":"GrooveScheduleAspect.java", "lineNumber":93,"className":"com.amazon.transportation.groove.aspectj.GrooveScheduleAspect","nativeMethod":false,"methodName":"validate","fileName":"ValidationActivitiesImpl.java", "lineNumber":23,"className":"com.amazon.cimsworkflow.activities.impl.ValidationActivitiesImpl","nativeMethod":false,"methodName":"invoke0","fileName":"NativeMethodAccessorImpl.java", "lineNumber":-2,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":true,"methodName":"invoke","fileName":"NativeMethodAccessorImpl.java","lineNumber":57 ,"className":"sun.reflect.NativeMethodAccessorImpl","nativeMethod":false,"methodName":"invoke","fileName":"DelegatingMethodAccessorImpl.java","lineNumber":43,"className":" sun.reflect.DelegatingMethodAccessorImpl","nativeMethod":false,"methodName":"invoke","fileName":"Meth od.java","lineNumber":606,"className":"java.lang.reflect.Method","nativeMethod":false,"methodName":"execute","fileName":"POJOActivityImplementation.java" ,"lineNumber":63,"className":"com.amazonaws.services.simpleworkflow.flow.pojo.POJOActivityImplementation","nativeMethod":false,"methodName":"execute","fileName":"ActivityImplementationBase. java","lineNumber":46,"className":"com.amazonaws.services.simpleworkflow.flow.generic.ActivityImplementationBase","nativeMethod":false,"methodName":"execute","fileName":" SynchronousActivityTaskPoller.java","lineNumber":196,"className":"com.amazonaws.services.simpleworkflow.flow.worker.SynchronousActivityTaskPoller","nativeMethod":false,"methodName":"run","fileName" :"ActivityTaskPoller.java","lineNumber":97,"className":"com.amazonaws.services.simpleworkflow.flow.worker.ActivityTaskPoller$1","nativeMethod":false,"methodName":"runWorker", "fileName":"ThreadPoolExecutor.java","lineNumber":1145,"className":"java.util.concurrent.ThreadPoolExecutor ","nativeMethod":false,"methodName":"run","fileName":"ThreadPoolExecutor.java","lineNumber":615,"className":"java.util.concurrent.ThreadPoolExecutor$Worker", "nativeMethod":false,"methodName":"run","fileName":"Thread.java","lineNumber":744,"className":"java.lang.Thread","nativeMethod":false ],"消息":"尝试 在 AsyncScope.doAsync() 之外执行异步代码 method","localizedMessage":"尝试执行异步代码 在 AsyncScope.doAsync() 之外 方法","抑制":["[Ljava.lang.Throwable;",[]]]

原因

尝试在 AsyncScope.doAsync() 方法之外执行异步代码

我的任务列表是我创建的新列表。线程也符合预期。但我收到了这个错误。有关如何解决此问题的任何线索。请回复

【问题讨论】:

【参考方案1】:

AWS Flow Framework 活动实施不能包含任何异步代码。所有此类代码仅在工作流实现中允许使用。从堆栈跟踪来看,您的活动实现确实引用了 TryCatch 类,该类只能用于异步错误处理。

【讨论】:

可以使用手动补全实现Activity的异步实现吗? 是的,活动可以异步实现,因为完成请求可以来自任何线程甚至进程。但问题是 Pradeep 试图在不支持开箱即用的活动实现中使用 Flow Framework 异步 TryCatch。确实可以使用 Flow Framework 来实现工作流范围之外的异步程序。使用 com.amazonaws.services.simpleworkflow.flow.core.AsyncScope 作为根范围和 eventLoop。【参考方案2】:

不同的活动不能有相同的任务列表名称。每个活动需要不同的任务列表名称。 如果您希望同一活动轮询多个任务列表,则运行同一活动的多个实例并使每个实例轮询不同的任务列表。

【讨论】:

以上是关于活动的单独任务列表 - AWS SWF的主要内容,如果未能解决你的问题,请参考以下文章

从片段访问数据库以在列表中显示

Actionscript 3 - 在我的 swf 中加载另一个 swf 时出现列表错误

监控AWS EC2实例上的活动

ruby 无需窝。由于用户只能看到自己的列表和任务,因此您不必嵌套这些资源。在yo中单独定义它们

动态更新两个JSF PrimeFaces列表框

如何在 C 中将链接列表解连接为 3 个单独的链接列表?