6 Replies Latest reply on Mar 12, 2012 4:02 PM by malabalu

    JBPM 5

    Amin MC Newbie

      Hi

       

      I am trying to build a prototype application using JBPM 5 however I am struggling to implement my usecase.  Is there any documentation which explains some of the core concepts of how to use the BPMN 2 notations? I have tried developing on the examples provided in the test source directory however i seem to get the strange behaviour.   The following shows the issues i'm having:

       

      {code:xml}

      <?xml version="1.0" encoding="UTF-8"?>

      <definitions

                   targetNamespace="http://www.example.org/MinimalExample"

                   typeLanguage="http://www.java.com/javaTypes"

                   expressionLanguage="http://www.mvel.org/2.0"

                   xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

                   xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"

                   xs:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

                   xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

                   xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

                   xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

                   xmlns:tns="http://www.jboss.org/drools">

       

          <itemDefinition structureRef="InputData"/>

          <itemDefinition structureRef="OutputData"/>

       

          <message itemRef="_aBreak"/>

       

          <interface>

              <operation>

                  <inMessageRef>_aBreakInput</inMessageRef>

              </operation>

          </interface>

       

          <process processType="Private" isExecutable="true"

                  >

              <property itemSubjectRef="_aBreak"/>

              <property itemSubjectRef="_workItem"/>

       

              <startEvent/>

              <scriptTask>

                  <script><![CDATA[

                          System.out.println("Received new break with account number "+  break.getAccountNumber() + " and description " + break.getDescription());

                          ]]>

                  </script>

              </scriptTask>

       

              <serviceTask operationRef="breakToWorkItem" implementation="Other">

                  <ioSpecification>

                      <dataInput/>

                      <dataOutput/>

                      <inputSet>

                          <dataInputRefs>breakInputParam</dataInputRefs>

                      </inputSet>

                      <outputSet>

                          <dataOutputRefs>workItemResult</dataOutputRefs>

                      </outputSet>

                  </ioSpecification>

                  <dataInputAssociation>

                      <sourceRef>break</sourceRef>

                      <targetRef>breakInputParam</targetRef>

                  </dataInputAssociation>

                  <dataOutputAssociation>

                      <sourceRef>workItemResult</sourceRef>

                      <targetRef>workItem</targetRef>

                  </dataOutputAssociation>

              </serviceTask>

              <endEvent />

       

              <intermediateCatchEvent>

                   <signalEventDefinition signalRef="MyMessage"/>

              </intermediateCatchEvent>

              <scriptTask>

                  <script>

                      <![CDATA[

                          System.out.println(workItem);

                      ]]>

                  </script>

              </scriptTask>

       

       

              <endEvent>

                  <terminateEventDefinition/>

              </endEvent>

       

              <sequenceFlow sourceRef="_1" targetRef="_2"/>

              <sequenceFlow sourceRef="_2" targetRef="_3"/>

              <sequenceFlow sourceRef="_3" targetRef="_4"/>

              <sequenceFlow sourceRef="_5" targetRef="_6"/>

              <sequenceFlow sourceRef="_6" targetRef="_7"/>

       

       

          </process>

       

       

      </definitions>

       

      {code}

       

      As I would expect that the process instance should not complete until there is an event signalled in signalEventDefinition signalRef="MyMessage". I would expect that only when I do a session.signalEvent(...) with the MyMessage then the process will complete based on the sequence flow and as I've seen in the example.  However not matter what my process completes without signalling the event.  Can some please provide some advice.  I have been looking at this for 3 days now.....

       

       

      Any help would be appreciated.

       

      Thanks

      Amin

        • 1. Re: JBPM 5
          Amin MC Newbie

          Hi

           

          Apologies for posting to this thread again but I was wondering if I could get some help on this.  I've tried some simple examples of intermediateCatchEvent and I still get the same results.  Process completes even when there is no signal events.   I feel I just some small guidance and then I'll be full steam ahead.

           

          Thanks

          Amin

          • 2. Re: JBPM 5
            Kris Verlaenen Master

            Amin,

             

            The process instance will auto-complete if there are no more active node instances currently executing.  In this case, once it reaches your first end node, it will find no other active nodes and will complete the process instance.  Note that the signal event node does not prevent this, as that node is not active at the time and we can't wait for it as it might never occur.

             

            If you always want to wait for the signal, you should model this using a converging parallel gateway.

             

            Kris

            • 3. Re: JBPM 5
              onkar ruikar Newbie

              Hey please refer http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-flow/html_single/index.html

              This will help you implement bpmn using drools flow.

              • 4. Re: JBPM 5
                sebastien chausson Newbie

                Hmmm, I do not understand how the execution engine behaves when he meets such a definition in process definition file :

                 

                <startEvent id="_1" name="StartProcess" >

                ...

                <signalEventDefinition signalRef="MyStartSignal" />

                </startEvent>

                 

                 

                Could you enlight about that ?

                Basically, I would have expect that it wait until "someone" send the event to the process engine, but you seems to say that in fact, the behavior is the same if the line "signalEventDefinition" is not there, right ?

                 

                 

                Many thantks for your precious help

                • 5. Re: JBPM 5
                  malabalu Newbie

                  Kris

                     Can you put it in a  quick example please? I am looking for soemthing like this too? I need my process to wait for an external signal at soem point in the process..Also how do I make the process instance to persist before that external signal.

                   

                  thanks

                  Malathi

                  • 6. Re: JBPM 5
                    malabalu Newbie

                    I got it working like you said.It is oersisting too before the gateway.

                     

                     

                    pasting the xml if anybody is interested.

                     

                    <?xml version="1.0" encoding="UTF-8"?>

                    <definitions id="Definition"

                                 targetNamespace="http://www.jboss.org/drools"

                                 typeLanguage="http://www.java.com/javaTypes"

                                 expressionLanguage="http://www.mvel.org/2.0"

                                 xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"

                                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                                 xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"

                                 xmlns:g="http://www.jboss.org/drools/flow/gpd"

                                 xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"

                                 xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"

                                 xmlns:di="http://www.omg.org/spec/DD/20100524/DI"

                                 xmlns:tns="http://www.jboss.org/drools">

                     

                     

                      <itemDefinition id="_testItem" />

                     

                     

                      <process processType="Private" isExecutable="true" id="servicetask" name="Sample Process" tns:packageName="defaultPackage" >

                     

                     

                        <!-- process variables -->

                        <property id="test" itemSubjectRef="_testItem"/>

                     

                     

                        <!-- nodes -->

                        <startEvent id="_1" name="StartProcess" />

                        <intermediateCatchEvent id="_4" name="Signal" >

                          <dataOutput id="_4_Output" name="event" />

                          <dataOutputAssociation>

                          <sourceRef>_4_Output</sourceRef>

                          <targetRef>test</targetRef>

                          </dataOutputAssociation>

                          <outputSet>

                            <dataOutputRefs>_4_Output</dataOutputRefs>

                          </outputSet>

                          <signalEventDefinition signalRef="MyTest"/>

                        </intermediateCatchEvent>

                        <scriptTask id="_5" name="Script" scriptFormat="http://www.java.com/java" >

                          <script>System.out.println("after the signal"+test);</script>

                        </scriptTask>

                        <endEvent id="_6" name="End" >

                            <terminateEventDefinition/>

                        </endEvent>

                        <scriptTask id="_7" name="Script" scriptFormat="http://www.java.com/java" >

                          <script>System.out.println("I am before the signal");</script>

                        </scriptTask>

                        <parallelGateway id="_8" name="Gateway" gatewayDirection="Converging" />

                     

                     

                        <!-- connections -->

                        <sequenceFlow id="_8-_5" sourceRef="_8" targetRef="_5" />

                        <sequenceFlow id="_5-_6" sourceRef="_5" targetRef="_6" />

                        <sequenceFlow id="_1-_7" sourceRef="_1" targetRef="_7" />

                        <sequenceFlow id="_7-_8" sourceRef="_7" targetRef="_8" />

                        <sequenceFlow id="_4-_8" sourceRef="_4" targetRef="_8" />

                     

                     

                      </process>

                     

                     

                      <bpmndi:BPMNDiagram>

                        <bpmndi:BPMNPlane bpmnElement="servicetask" >

                          <bpmndi:BPMNShape bpmnElement="_1" >

                            <dc:Bounds x="46" y="74" width="48" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNShape bpmnElement="_4" >

                            <dc:Bounds x="15" y="184" width="48" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNShape bpmnElement="_5" >

                            <dc:Bounds x="202" y="277" width="80" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNShape bpmnElement="_6" >

                            <dc:Bounds x="391" y="295" width="48" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNShape bpmnElement="_7" >

                            <dc:Bounds x="200" y="68" width="80" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNShape bpmnElement="_8" >

                            <dc:Bounds x="379" y="106" width="48" height="48" />

                          </bpmndi:BPMNShape>

                          <bpmndi:BPMNEdge bpmnElement="_8-_5" >

                            <di:waypoint x="403" y="130" />

                            <di:waypoint x="242" y="301" />

                          </bpmndi:BPMNEdge>

                          <bpmndi:BPMNEdge bpmnElement="_5-_6" >

                            <di:waypoint x="242" y="301" />

                            <di:waypoint x="415" y="319" />

                          </bpmndi:BPMNEdge>

                          <bpmndi:BPMNEdge bpmnElement="_1-_7" >

                            <di:waypoint x="70" y="98" />

                            <di:waypoint x="240" y="92" />

                          </bpmndi:BPMNEdge>

                          <bpmndi:BPMNEdge bpmnElement="_7-_8" >

                            <di:waypoint x="240" y="92" />

                            <di:waypoint x="403" y="130" />

                          </bpmndi:BPMNEdge>

                          <bpmndi:BPMNEdge bpmnElement="_4-_8" >

                            <di:waypoint x="39" y="208" />

                            <di:waypoint x="403" y="130" />

                          </bpmndi:BPMNEdge>

                        </bpmndi:BPMNPlane>

                      </bpmndi:BPMNDiagram>

                     

                     

                    </definitions>