我想在activiti中抛出并捕获中间消息捕获事件。但我不知道如何实现它。以下是我的bpmn,我通过中间消息事件将web服务与其他人类会话联系起来。
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<message id="msg" name="msg"></message>
<process id="process" isExecutable="true">
<startEvent id="start" name="start" activiti:initiator="initiator"></startEvent>
<serviceTask id="upload" name="upload project" activiti:exclusive="false" activiti:class="fitman.services.MyAuthUser_WS"></serviceTask>
<userTask id="provide" name="provide project details" activiti:assignee="${initiator}">
<extensionElements>
<activiti:formProperty id="user" name="user" type="user" required="true"></activiti:formProperty>
<activiti:formProperty id="name" name="name" type="string"></activiti:formProperty>
<activiti:formProperty id="toAddress" name="toAddress" type="string"></activiti:formProperty>
<activiti:formProperty id="subject" name="subject" type="string"></activiti:formProperty>
<activiti:formProperty id="textBody" name="textBody" type="string"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="sid-8D423749-D7C6-4617-843B-FC4B62CC2E0A" sourceRef="start" targetRef="provide"></sequenceFlow>
<sequenceFlow id="sid-50642463-711F-4AD0-ABFC-F1A383392D4D" sourceRef="provide" targetRef="upload"></sequenceFlow>
<sequenceFlow id="sid-9611F0F0-6CC0-4F56-8A7B-35624A0BB2D2" sourceRef="upload" targetRef="msg1"></sequenceFlow>
<userTask id="validate" name="validate" activiti:assignee="msg1"></userTask>
<sequenceFlow id="sid-B4044992-C9F3-47C8-A206-99CABAC46B6D" sourceRef="msg1" targetRef="validate"></sequenceFlow>
<endEvent id="end"></endEvent>
<sequenceFlow id="sid-163DD9FE-3708-4A6B-85FC-EB1E2354182B" sourceRef="validate" targetRef="end"></sequenceFlow>
<intermediateCatchEvent id="msg1" name="msg1">
<messageEventDefinition messageRef="msg"></messageEventDefinition>
</intermediateCatchEvent>
</process>
</definitions>
我做错了什么或者知道如何实现它。
现在我正在使用信号,但是在捕获之后仍然无法启动其他用户任务;我做错了什么?
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
<signal id="newMsg" name="newMsg"></signal>
<process id="model1" isExecutable="true">
<startEvent id="start" activiti:initiator="initiator"></startEvent>
<userTask id="task1" name="task1" activiti:assignee="${initiator}">
<extensionElements>
<activiti:formProperty id="a" name="a" type="string"></activiti:formProperty>
</extensionElements>
</userTask>
<sequenceFlow id="sid-16842953-EA94-42A2-B116-C68A98C85090" sourceRef="start" targetRef="task1"></sequenceFlow>
<sequenceFlow id="sid-E2E35140-E272-4D5C-88A1-CD1039E6672B" sourceRef="task1" targetRef="serv1"></sequenceFlow>
<sequenceFlow id="sid-9E02B791-B3C0-4B62-81BB-DA10424469DF" sourceRef="serv1" targetRef="s1"></sequenceFlow>
<intermediateCatchEvent id="s1" name="s1">
<signalEventDefinition signalRef="newMsg"></signalEventDefinition>
</intermediateCatchEvent>
<userTask id="task2" name="task2" activiti:assignee="s1">
<extensionElements>
<activiti:formProperty id="prenom" name="prenom" type="string"></activiti:formProperty>
<activiti:taskListener event="create" class="fitman.services.MyTaskListener"></activiti:taskListener>
</extensionElements>
</userTask>
<sequenceFlow id="sid-BC7E1EC1-6839-4440-A123-4127C00FAAA3" sourceRef="s1" targetRef="task2"></sequenceFlow>
<sequenceFlow id="sid-5A09EDC9-7B1F-4BAD-8D3B-DEB53A01768A" sourceRef="task2" targetRef="serv2"></sequenceFlow>
<sequenceFlow id="sid-1DCF980A-AB99-4839-A5BA-8900A1AA0D51" sourceRef="serv2" targetRef="end"></sequenceFlow>
<serviceTask id="serv1" name="serv1" activiti:class="fitman.services.MyAuthUser_WS"></serviceTask>
<serviceTask id="serv2" name="serv2" activiti:class="fitman.services.MyAuthUser_WS"></serviceTask>
<endEvent id="end" name="end"></endEvent>
</process>
</definitions>
答案 0 :(得分:0)
除非事件来自BPMN环境之外,否则我建议您使用信号事件而不是消息事件。可以在流程实例中发出和捕获信号事件,其中常规消息事件需要在应用程序基础结构中配置处理程序。
如果需要tre消息事件,那么您应该考虑查看camel任务模块,因为这允许您发送和接收来自多个源/目标的消息。