cancel
Showing results for 
Search instead for 
Did you mean: 

is this a valid BPN definition

priyanshu
Champ in-the-making
Champ in-the-making

6 REPLIES 6

afaust
Legendary Innovator
Legendary Innovator

This is just a graphical representation of a definition, not a definition in itself. Technically, it appears valid. The bigger question is, if a specific implementation of a BPMN engine will process it correctly / as expected at runtime.

Personally, I prefer to pair each forking gateway up with exactly one joining gateway, and not abuse one joining gateway to aggregate flows from multiple forking ones. In your definition, you have 3 forking gateways and only one joining one. It is also quite uncommon (yet technically allowed) to have a task behaviour with two incoming sequence flows - typically you'll see a (exclusive) gateway to combine multiple sequence flows into a single one before going into a task.

I also don't get your use of the parallel gateway before the end event. Why would you want to have a parallel fork, where one flow immediately terminates and the other starts from the beginning? Wouldn't it logically be more approriate to use an exclusive gateway to make the determination to either stop the process or continue it (a sort-of loop continuation decision)?

priyanshu
Champ in-the-making
Champ in-the-making

Actually, I am using an exclusive gateway instead of parallel gateway before the end gateway to loop in the same process instance and all the service task are not getting executed but as soon as break the loop the process flows seamlessly.Do you have any Idea what would be the reason?

afaust
Legendary Innovator
Legendary Innovator

Your diagram only shows parallel gateways, so if you already use an exclusive gateway then the diagram you posted may no longer be up to date.

Maybe you should also provide your underlying BPMN file, which would make things a bit easier, since only the BPMN file is the actual source of truth.

priyanshu
Champ in-the-making
Champ in-the-making

I have eclosed the latest BPMN definition.Problem is similar that if we have a loop from last exclusive gateway to the beginning join gateway (one after start event) only the activity which happened after immediate fork executes and then the process execution is stuck and nothing  happens  but as soon as we break the loop from the last exclusive gateway before the end gateway to the beginning join gateway then the process flows seamlessly.

<?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:xsd="http://www.w3.org/2001/XMLSchema" 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">
<process id="inclusiveGatewayTestWithForkWithInForkWithJoin2" name="Inclusive Gateway Test" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<userTask id="usertask1" name="User Task"></userTask>
<serviceTask id="servicetask1" name="Service Task" activiti:expression="${printMessageService.execute(execution)}"></serviceTask>
<inclusiveGateway id="inclusivegateway1" name="Inclusive Gateway"></inclusiveGateway>
<sequenceFlow id="flow3" sourceRef="servicetask1" targetRef="inclusivegateway1"></sequenceFlow>
<serviceTask id="servicetask3" name="Service Task" activiti:expression="${printMessageService2.execute(execution)}"></serviceTask>
<serviceTask id="servicetask4" name="Service Task" activiti:expression="${printMessageService3.execute(execution)}"></serviceTask>
<sequenceFlow id="flow5" sourceRef="inclusivegateway1" targetRef="servicetask3"></sequenceFlow>
<intermediateCatchEvent id="timerintermediatecatchevent1" name="TimerCatchEvent">
<timerEventDefinition>
<timeDuration>PT10S</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<sequenceFlow id="flow15" sourceRef="inclusivegateway1" targetRef="timerintermediatecatchevent1"></sequenceFlow>
<sequenceFlow id="flow16" sourceRef="timerintermediatecatchevent1" targetRef="servicetask4"></sequenceFlow>
<inclusiveGateway id="inclusivegateway2" name="Inclusive Gateway"></inclusiveGateway>
<sequenceFlow id="flow18" sourceRef="servicetask3" targetRef="inclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow19" sourceRef="servicetask4" targetRef="inclusivegateway2"></sequenceFlow>
<inclusiveGateway id="inclusivegateway3" name="Inclusive Gateway"></inclusiveGateway>
<intermediateCatchEvent id="timerintermediatecatchevent2" name="TimerCatchEvent">
<timerEventDefinition>
<timeDuration>PT10S</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<serviceTask id="servicetask5" name="Service Task" activiti:expression="${printMessageService5.execute(execution)}"></serviceTask>
<sequenceFlow id="flow22" sourceRef="inclusivegateway3" targetRef="timerintermediatecatchevent2"></sequenceFlow>
<sequenceFlow id="flow23" sourceRef="timerintermediatecatchevent2" targetRef="servicetask5"></sequenceFlow>
<serviceTask id="servicetask6" name="Service Task" activiti:expression="${printMessageService4.execute(execution)}"></serviceTask>
<sequenceFlow id="flow24" sourceRef="inclusivegateway3" targetRef="servicetask6"></sequenceFlow>
<inclusiveGateway id="inclusivegateway4" name="Inclusive Gateway"></inclusiveGateway>
<sequenceFlow id="flow27" sourceRef="startevent1" targetRef="inclusivegateway4"></sequenceFlow>
<sequenceFlow id="flow28" sourceRef="inclusivegateway4" targetRef="usertask1"></sequenceFlow>
<sequenceFlow id="flow33" sourceRef="usertask1" targetRef="servicetask1"></sequenceFlow>
<sequenceFlow id="flow35" sourceRef="inclusivegateway2" targetRef="inclusivegateway3"></sequenceFlow>
<sequenceFlow id="flow36" sourceRef="servicetask6" targetRef="inclusivegateway7"></sequenceFlow>
<sequenceFlow id="flow37" sourceRef="servicetask5" targetRef="inclusivegateway7"></sequenceFlow>
<serviceTask id="servicetask7" name="Service Task" activiti:expression="${printMessageService2.execute(execution)}"></serviceTask>
<sequenceFlow id="flow38" sourceRef="inclusivegateway1" targetRef="servicetask7"></sequenceFlow>
<inclusiveGateway id="inclusivegateway5" name="Inclusive Gateway"></inclusiveGateway>
<sequenceFlow id="flow39" sourceRef="servicetask7" targetRef="inclusivegateway5"></sequenceFlow>
<serviceTask id="servicetask8" name="Service Task" activiti:expression="${printMessageService2.execute(execution)}"></serviceTask>
<serviceTask id="servicetask9" name="Service Task" activiti:expression="${printMessageService2.execute(execution)}"></serviceTask>
<sequenceFlow id="flow41" sourceRef="inclusivegateway5" targetRef="servicetask9"></sequenceFlow>
<inclusiveGateway id="inclusivegateway6" name="Inclusive Gateway"></inclusiveGateway>
<sequenceFlow id="flow42" sourceRef="servicetask8" targetRef="inclusivegateway6"></sequenceFlow>
<sequenceFlow id="flow43" sourceRef="servicetask9" targetRef="inclusivegateway6"></sequenceFlow>
<inclusiveGateway id="inclusivegateway7" name="Exclusive Gateway"></inclusiveGateway>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow45" sourceRef="inclusivegateway5" targetRef="servicetask8"></sequenceFlow>
<sequenceFlow id="flow47" sourceRef="inclusivegateway6" targetRef="inclusivegateway7"></sequenceFlow>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow48" sourceRef="inclusivegateway7" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="flow49" sourceRef="exclusivegateway1" targetRef="endevent1"></sequenceFlow>
<sequenceFlow id="flow50" sourceRef="exclusivegateway1" targetRef="inclusivegateway4"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_inclusiveGatewayTestWithForkWithInForkWithJoin2">
<bpmndi:BPMNPlane bpmnElement="inclusiveGatewayTestWithForkWithInForkWithJoin2" id="BPMNPlane_inclusiveGatewayTestWithForkWithInForkWithJoin2">
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
<omgdc:Bounds height="35.0" width="35.0" x="80.0" y="251.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
<omgdc:Bounds height="55.0" width="105.0" x="300.0" y="241.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask1" id="BPMNShape_servicetask1">
<omgdc:Bounds height="55.0" width="105.0" x="500.0" y="241.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway1" id="BPMNShape_inclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="680.0" y="248.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask3" id="BPMNShape_servicetask3">
<omgdc:Bounds height="55.0" width="105.0" x="770.0" y="241.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask4" id="BPMNShape_servicetask4">
<omgdc:Bounds height="55.0" width="105.0" x="780.0" y="361.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerintermediatecatchevent1" id="BPMNShape_timerintermediatecatchevent1">
<omgdc:Bounds height="35.0" width="35.0" x="683.0" y="371.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway2" id="BPMNShape_inclusivegateway2">
<omgdc:Bounds height="40.0" width="40.0" x="940.0" y="251.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway3" id="BPMNShape_inclusivegateway3">
<omgdc:Bounds height="40.0" width="40.0" x="1050.0" y="251.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="timerintermediatecatchevent2" id="BPMNShape_timerintermediatecatchevent2">
<omgdc:Bounds height="35.0" width="35.0" x="1053.0" y="361.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask5" id="BPMNShape_servicetask5">
<omgdc:Bounds height="55.0" width="105.0" x="1149.0" y="349.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask6" id="BPMNShape_servicetask6">
<omgdc:Bounds height="55.0" width="105.0" x="1149.0" y="175.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway4" id="BPMNShape_inclusivegateway4">
<omgdc:Bounds height="40.0" width="40.0" x="190.0" y="250.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask7" id="BPMNShape_servicetask7">
<omgdc:Bounds height="55.0" width="105.0" x="750.0" y="55.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway5" id="BPMNShape_inclusivegateway5">
<omgdc:Bounds height="40.0" width="40.0" x="910.0" y="69.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask8" id="BPMNShape_servicetask8">
<omgdc:Bounds height="55.0" width="105.0" x="1005.0" y="109.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="servicetask9" id="BPMNShape_servicetask9">
<omgdc:Bounds height="55.0" width="105.0" x="1005.0" y="1.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway6" id="BPMNShape_inclusivegateway6">
<omgdc:Bounds height="40.0" width="40.0" x="1160.0" y="62.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="inclusivegateway7" id="BPMNShape_inclusivegateway7">
<omgdc:Bounds height="40.0" width="40.0" x="1320.0" y="251.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
<omgdc:Bounds height="35.0" width="35.0" x="1440.0" y="253.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
<omgdc:Bounds height="40.0" width="40.0" x="1380.0" y="251.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
<omgdi:waypoint x="605.0" y="268.0"></omgdi:waypoint>
<omgdi:waypoint x="680.0" y="268.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
<omgdi:waypoint x="720.0" y="268.0"></omgdi:waypoint>
<omgdi:waypoint x="770.0" y="268.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow15" id="BPMNEdge_flow15">
<omgdi:waypoint x="700.0" y="288.0"></omgdi:waypoint>
<omgdi:waypoint x="700.0" y="371.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow16" id="BPMNEdge_flow16">
<omgdi:waypoint x="718.0" y="388.0"></omgdi:waypoint>
<omgdi:waypoint x="780.0" y="388.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow18" id="BPMNEdge_flow18">
<omgdi:waypoint x="875.0" y="268.0"></omgdi:waypoint>
<omgdi:waypoint x="940.0" y="271.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow19" id="BPMNEdge_flow19">
<omgdi:waypoint x="885.0" y="388.0"></omgdi:waypoint>
<omgdi:waypoint x="960.0" y="388.0"></omgdi:waypoint>
<omgdi:waypoint x="960.0" y="291.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow22" id="BPMNEdge_flow22">
<omgdi:waypoint x="1070.0" y="291.0"></omgdi:waypoint>
<omgdi:waypoint x="1070.0" y="361.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow23" id="BPMNEdge_flow23">
<omgdi:waypoint x="1088.0" y="378.0"></omgdi:waypoint>
<omgdi:waypoint x="1149.0" y="376.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow24" id="BPMNEdge_flow24">
<omgdi:waypoint x="1070.0" y="251.0"></omgdi:waypoint>
<omgdi:waypoint x="1069.0" y="202.0"></omgdi:waypoint>
<omgdi:waypoint x="1149.0" y="202.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow27" id="BPMNEdge_flow27">
<omgdi:waypoint x="115.0" y="268.0"></omgdi:waypoint>
<omgdi:waypoint x="190.0" y="270.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow28" id="BPMNEdge_flow28">
<omgdi:waypoint x="230.0" y="270.0"></omgdi:waypoint>
<omgdi:waypoint x="300.0" y="268.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow33" id="BPMNEdge_flow33">
<omgdi:waypoint x="405.0" y="268.0"></omgdi:waypoint>
<omgdi:waypoint x="500.0" y="268.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow35" id="BPMNEdge_flow35">
<omgdi:waypoint x="980.0" y="271.0"></omgdi:waypoint>
<omgdi:waypoint x="1050.0" y="271.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow36" id="BPMNEdge_flow36">
<omgdi:waypoint x="1254.0" y="202.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="202.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="251.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow37" id="BPMNEdge_flow37">
<omgdi:waypoint x="1254.0" y="376.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="376.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="291.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow38" id="BPMNEdge_flow38">
<omgdi:waypoint x="700.0" y="248.0"></omgdi:waypoint>
<omgdi:waypoint x="700.0" y="80.0"></omgdi:waypoint>
<omgdi:waypoint x="750.0" y="82.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow39" id="BPMNEdge_flow39">
<omgdi:waypoint x="855.0" y="82.0"></omgdi:waypoint>
<omgdi:waypoint x="910.0" y="89.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow41" id="BPMNEdge_flow41">
<omgdi:waypoint x="930.0" y="69.0"></omgdi:waypoint>
<omgdi:waypoint x="928.0" y="28.0"></omgdi:waypoint>
<omgdi:waypoint x="1005.0" y="28.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow42" id="BPMNEdge_flow42">
<omgdi:waypoint x="1110.0" y="136.0"></omgdi:waypoint>
<omgdi:waypoint x="1180.0" y="132.0"></omgdi:waypoint>
<omgdi:waypoint x="1180.0" y="102.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow43" id="BPMNEdge_flow43">
<omgdi:waypoint x="1110.0" y="28.0"></omgdi:waypoint>
<omgdi:waypoint x="1180.0" y="28.0"></omgdi:waypoint>
<omgdi:waypoint x="1180.0" y="62.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow45" id="BPMNEdge_flow45">
<omgdi:waypoint x="930.0" y="109.0"></omgdi:waypoint>
<omgdi:waypoint x="928.0" y="133.0"></omgdi:waypoint>
<omgdi:waypoint x="1005.0" y="136.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow47" id="BPMNEdge_flow47">
<omgdi:waypoint x="1200.0" y="82.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="82.0"></omgdi:waypoint>
<omgdi:waypoint x="1340.0" y="251.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow48" id="BPMNEdge_flow48">
<omgdi:waypoint x="1360.0" y="271.0"></omgdi:waypoint>
<omgdi:waypoint x="1380.0" y="271.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow49" id="BPMNEdge_flow49">
<omgdi:waypoint x="1420.0" y="271.0"></omgdi:waypoint>
<omgdi:waypoint x="1440.0" y="270.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="flow50" id="BPMNEdge_flow50">
<omgdi:waypoint x="1400.0" y="291.0"></omgdi:waypoint>
<omgdi:waypoint x="1400.0" y="601.0"></omgdi:waypoint>
<omgdi:waypoint x="208.0" y="600.0"></omgdi:waypoint>
<omgdi:waypoint x="210.0" y="290.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

afaust
Legendary Innovator
Legendary Innovator

Please never paste that much source code into a comment without using the syntax highlighter feature (use edit from the thread page - edit from within your inbox will not give you that tool in the toolbar). I have modified your post to use syntax highlighter to make it more readable.

afaust
Legendary Innovator
Legendary Innovator

Now you are no longer using parallel gateways but inclusive gateways. None of the sequence flows leaving inclusive gateways have any condition applied to them, so technically they all act like parallel gateways anyway. Also, none of the sequence flows leaving your single exclusive gateway has a condition and neither is marked as the default sequence flow, so the process will fail to choose the correct transition or may even fail / stop at this point.

You also seem to be referring to custom beans via serviceTask expressions, i.e. printMessageService2. Have you registered such a bean correctly with the Activiti engine so that it is available in the context? If not, then your service tasks will fail to be called and the entire process will hang.