在Activit和esper引擎中分配资源

时间:2015-11-07 01:29:30

标签: activiti esper

我正在尝试修改一个代码,该代码检测来自activiti引擎的事件并将它们抛到ESPER流上,并尝试映射和更改它们的变量并在同一个流上抛出新事件。为了做到这一点,我创建了一个命名窗口,将从Activiti中检测到的所有事件抛入其中

epAdmin.createEPL("create window intermwindow.win:keepall() as select taskInstanceId,receiveTime,requestedAmount,eventType from tasklistenerlogic", "cepStatementmainquerywindow"); //create a new named window 

epAdmin.createEPL("insert into intermwindow(taskInstanceId, receiveTime, requestedAmount, eventType ) select taskInstanceId,receiveTime,requestedAmount,'created' from tasklistenerlogic where eventType = 'create' ", "cepStatementmainquerywindowii1");

epAdmin.createEPL("insert into intermwindow(taskInstanceId, receiveTime, requestedAmount, eventType ) select taskInstanceId,receiveTime,requestedAmount,'allocated' from tasklistenerlogic where eventType = 'assignment' ", "cepStatementmainquerywindowii2");

epAdmin.createEPL("insert into intermwindow(taskInstanceId, receiveTime, requestedAmount, eventType) select taskInstanceId,receiveTime,requestedAmount,'completed' from tasklistenerlogic where eventType = 'complete' ", "cepStatementmainquerywindowii3");

epAdmin.createEPL("select * from intermwindow", "cepStatementmainquerywindowo");

我需要做的就是将多个资源分配给同一个任务,如下所述

taskService.setAssignee(taskService.createTaskQuery().singleResult().getId(),"Atef");

taskService.setAssignee(taskService.createTaskQuery().singleResult().getId(),"Ramadan");

这是我得到的输出:

>>> Throwing event: task  assignment  successfully: LoanRequestReceivedEvent{taskInstanceId= 9,receiveTime= 1446853025179,requestedAmount= 10,eventtype= assignment,resource= Atef}
event mapped successfully:  {receiveTime=1446853025179, requestedAmount=10, taskInstanceId=9, eventType=allocated}
>>> Throwing event: task  assignment  successfully: LoanRequestReceivedEvent{taskInstanceId= 9,receiveTime= 1446853025226,requestedAmount= 10,eventtype= assignment,resource= Ramadan}
event mapped successfully:  {receiveTime=1446853025226, requestedAmount=10, taskInstanceId=9, eventType=allocated}

问题在于,每当我尝试编写查询以获取相同taskID的所有不同资源时,就像这样

epAdmin.createEPL("select * from pattern [ every tasklistenerlogic(resource = \"Atef\") -> tasklistenerlogic(resource = \"Ramadan\") ]", "q3");

出现此错误: 测试错误:

testEsperActivitiSetup(org.bpmnwithactiviti.chapter14.LoanRequestProcessWithEsperTest): Property named 'resource' is not valid in any stream [select * from pattern [ every tasklistenerlogic(resource = "Atef") -> tasklistenerlogic(resource = "Ramadan") ]]

我不知道如何解决这个问题,任何想法都将受到赞赏

0 个答案:

没有答案