04-26-2013 02:55 PM
<?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/test">
<message id="message1" name="message1"></message>
<process id="sampleProcess1" name="Sample Process 1">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="servicetask1" name="Service Task" activiti:async="true" activiti:exclusive="false" activiti:class="org.example.activiti.service.ServiceClass1"></serviceTask>
<userTask id="usertask1" name="User Task"></userTask>
<intermediateCatchEvent id="messageintermediatecatchevent1" name="MessageCatchEvent">
<messageEventDefinition messageRef="message1"></messageEventDefinition>
</intermediateCatchEvent>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<endEvent id="endevent1" name="End"></endEvent>
<serviceTask id="servicetask2" name="Service Task" activiti:class="org.example.activiti.service.ServiceClass2"></serviceTask>
<scriptTask id="scripttask1" name="Script Task" scriptFormat="groovy">
<script><![CDATA[println( "resuming after receiving message1 event" );]]></script>
</scriptTask>
<scriptTask id="scripttask2" name="Script Task" scriptFormat="groovy">
<script><![CDATA[println( "Flow NOT altered" );]]></script>
</scriptTask>
<scriptTask id="scripttask3" name="Script Task" scriptFormat="groovy">
<script></script>
</scriptTask>
<sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="servicetask1" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="flow5" name="" sourceRef="exclusivegateway1" targetRef="scripttask2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${alterFlowFlag == false}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow6" name="" sourceRef="exclusivegateway1" targetRef="scripttask3">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${alterFlowFlag == true}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow7" name="" sourceRef="messageintermediatecatchevent1" targetRef="scripttask1"></sequenceFlow>
<sequenceFlow id="flow8" name="" sourceRef="scripttask1" targetRef="servicetask1"></sequenceFlow>
<sequenceFlow id="flow9" name="" sourceRef="scripttask2" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow10" name="" sourceRef="scripttask3" targetRef="servicetask2"></sequenceFlow>
</process>
</definitions>
public void execute( DelegateExecution exec ) throws Exception {
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = engine.getRuntimeService();
runtimeService.messageEventReceived("message1", exec.getId(), null );
}
org.activiti.engine.ActivitiException: Execution with id '24801' does not have a subscription to a message event with name 'message1'
04-26-2013 04:02 PM
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
RuntimeService runtimeService = engine.getRuntimeService();
Execution msgExec = runtimeService.createExecutionQuery().processInstanceId(exec.getProcessInstanceId()).messageEventSubscriptionName("message1").singleResult();
runtimeService.messageEventReceived("message1", msgExec.getId(), null );
04-29-2013 08:05 AM
04-29-2013 10:58 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.