Skip to content

jdkuhne/bpmn-cmmn-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example to show BPMN and CMMN together

Example file with:

  • BPMN calling CMMN (sub)case
  • Passing variables

in CMMN:

  • milestone
  • sentry
  • stage
  • discretionary or manually activated task
  • repetitive task
  • entry/exit criterion

in BPMN:

  • Driving gateways based on CMMN variable/result"

Hidden Elements

There is a listener on the case completed milestone, that sets a caseExecution variable caseSuccessful to true.

Findings

  1. Case called from a process could not use exit criterions. Exit criterions mark the case as TERMINATED, but the process continues after the case is COMPLETED. Use the autoComplete marker instead.

  2. Stages could not be terminated by completing a single (manually activated) human task. case diagram See https://app.camunda.com/jira/browse/CAM-6087 and the linked forum posts for further details. Workarounds:

    • Mark the stage with autoComplete.
    • Terminate the other tasks with a task listener on complete event. See CompleteStageListener.java for details. This task listener isn't able to terminate available tasks (the ones with entry criterion) directly, they have to be in the state active. This is the error message:
ENGINE-05011 Could not perform transition 'terminate on case execution with id '419'.Reason: The case execution must be in state 'active' to terminate, but it was in state 'available'

Go for the autoComplete, here it works.

  1. Entry criterions can check if a variable has a certain value. But this variable has to be initialized (even empty) before, otherwise you will get a Unknown property used in expression exception. Workaround is to call the Java-API in the expression:
${caseExecution.hasVariable("customerValueChanged")}
  1. If you want to use beans with certain evaluation logic in entry criterions, the most easy way to trigger the evaluation on a change in bean state, is to set a case variable and include it in the ifPart:
<cmmn:ifPart id="IfPart_1">
    <cmmn:condition id="Expression_1"><![CDATA[${caseExecution.hasVariable("customerValueChanged") && customerValueBean.isValueHighEnough()}]]></cmmn:condition>
</cmmn:ifPart>

The activation of the Conditional activate task may look like this:

customerValueBean.setCustomerValue(1001);
caseService().setVariable(caseInstance.getCaseInstanceId(), "customerValueChanged", true);

Show me the important parts!

BPMN Process

How does it work?

How to use it?

There is no web interface to access the application. To get started refer to the InMemoryH2Test.

There is also an ArquillianTest, which by default connects to a Camunda BPM platform running locally on a JBoss Wildfly application server. You can download a Camunda BPM distribution for JBoss from the Camunda BPM download page.

You can also use ant to build and deploy the example to an application server. For that to work you need to copy the file build.properties.example to build.properties and configure the path to your application server inside it. Alternatively, you can also copy it to ${user.home}/.camunda/build.properties to have a central configuration that works with all projects generated by the Camunda BPM Maven Archetypes.

Once you deployed the application you can run it using Camunda Tasklist and inspect it using Camunda Cockpit.

Environment Restrictions

Built and tested against Camunda BPM version 7.7.0.

Known Limitations

Improvements Backlog

License

Apache License, Version 2.0.

About

Example Case and Process

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 88.6%
  • HTML 11.4%