Friday, November 18, 2011

Executable BPMN 2.0

Bruce Silver did a blog recently, wondering whether any tools already exist that truly support executable BPMN 2.0. He defines supporting executable BPMN 2.0 as not just following the graphical notation guidelines (that are probably not that different from BPMN 1.x), but also supporting the underling XML serialization. And not just the basic high-level elements, but also the details that are necessary to come to executable processes, like process data, data mappings, service interfaces, etc.

I believe that jBPM satisfies these requirements!

As of jBPM 5.0, we are now using the BPMN 2.0 specification, not just for the visual representation, but also as the underlying XML serialization. And it's more than an import/export format, it is the representation that our tools use to communicate with each other (instead of using yet another proprietary model for that). This means that you can round-trip your processes between your developers (using the Eclipse-based editor integrated in their development environment) and your business users (using the web-based designer) based on the BPMN 2.0 XML.

And yes, unlike some other vendors, we're following the BPMN 2.0 specification as close as possible, and avoid using custom extensions (whenever not necessary). This for example means that we use BPMNDI for storing the diagram information (i.e. location and size of the nodes etc.), like this (click here to see the full process):
  <bpmndi:BPMNDiagram>
    <bpmndi:BPMNPlane bpmnElement="Minimal" >
      <bpmndi:BPMNShape bpmnElement="_1" >
        <dc:Bounds x="15" y="91" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_2" >
        <dc:Bounds x="95" y="88" width="83" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="_3" >
        <dc:Bounds x="258" y="86" width="48" height="48" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="_1-_2" >
        <di:waypoint x="39" y="115" />
        <di:waypoint x="75" y="46" />
        <di:waypoint x="136" y="112" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="_2-_3" >
        <di:waypoint x="136" y="112" />
        <di:waypoint x="240" y="240" />
        <di:waypoint x="282" y="110" />
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>

Process data and input/output mappings are also defined using the (sometimes rather verbose) ioSpecification (full example here):
  <ioSpecification>
    <dataInput id="_4_employeeIdInput" name="employeeId" />
    <inputSet>
      <dataInputRefs>_4_employeeIdInput</dataInputRefs>
    </inputSet>
    <outputSet>
    </outputSet>
  </ioSpecification>
  <dataInputAssociation>
    <sourceRef>employee</sourceRef>
    <targetRef>_4_employeeIdInput</targetRef>
  </dataInputAssociation>

Or, if you want to invoke a service (a Java service in this case), the service is modeled like this:
  <itemDefinition id="_2_InMessageType" structureRef="java.lang.String" />
  <message id="_2_InMessage" itemRef="_2_InMessageType" />
  <interface id="_2_ServiceInterface" name="org.jbpm.examples.junit.HelloService">
    <operation id="_2_ServiceOperation" name="hello">
      <inMessageRef>_2_InMessage</inMessageRef>
    </operation>
  </interface>
and to invoke the service (full example here):
  <serviceTask id="_2" name="Hello" operationRef="_2_ServiceOperation" implementation="Other" >
    <ioSpecification>
      <dataInput id="_2_param" name="Parameter" />
      <dataOutput id="_2_result" name="Result" />
      <inputSet>
        <dataInputRefs>_2_param</dataInputRefs>
      </inputSet>
      <outputSet>
        <dataOutputRefs>_2_result</dataOutputRefs>
      </outputSet>
    </ioSpecification>
    <dataInputAssociation>
      <sourceRef>s</sourceRef>
      <targetRef>_2_param</targetRef>
    </dataInputAssociation>
    <dataOutputAssociation>
      <sourceRef>_2_result</sourceRef>
      <targetRef>s</targetRef>
    </dataOutputAssociation>
  </serviceTask>

jBPM already supports a significant subset of nodes (and other elements) that you can use to model executable processes. To get an idea of what this looks like using BPMN 2.0 XML, simply browse through the examples module. A full list of supported elements and attributes (which is very similar to the Common Executable subclass, but extended with a few more elements) is added as part of the documentation here.

And finally, our new Eclipse-based editor is almost ready, and that supports the full BPMN 2.0 specification, and uses the BPMN 2.0 XML to store these process models. You can for example download the BPMN 2.0 examples (that are included as part of the specification) and open them up, as shown in this screencast.

So who says there's no tool that supports executable BPMN 2.0 ? :)