Embedded Case Management with CMMN in camunda BPM

By
  • Blog
  • >
  • Embedded Case Management with CMMN in camunda BPM
TOPICS

30 Day Free Trial

Bring together legacy systems, RPA bots, microservices and more with Camunda

Sign Up for Camunda Content

Get the latest on Camunda features, events, top trends, and more.

TRENDING CONTENT
In our latest alpha release we include a preview of the upcoming support for CMMN (Case Management Model and Notation) in camunda BPM. Time to have a look at CMMN and the way it is implemented in camunda BPM.

 

What is CMMN?

CMMN is an emerging OMG standard for (Adaptive) Case Management. Version 1.0 is freshly released and vendor adoption starts to take off. Trisotech already provides a Web-based Modeler for CMMN and we at camunda have the ambition to provide the first embedded, Open Source Runtime Engine for CMMN.

CMMN allows modeling Cases. A case allows humans to do work in a more or less structured way in order to achieve something. Classic examples where case management is applied are Credit Application, Customer Support Management, Document Management, and so on.

The following is a simple Example of a Credit Application Case modeled in CMMN:

Example of a Credit Application Case modeled in CMMN

The Picture above shows the graphical representation of the CMMN Model. The model also has an executable XML representation which looks like this:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

<definitions id="_81291489-586f-4b00-b7c4-1ef8f7523c29"
                  targetNamespace="Examples"
                  xmlns="http://www.omg.org/spec/CMMN/20131201/MODEL"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <case id="loanApplication" name="Loan Application Case">

    <casePlanModel name="Loan Application" id="CasePlanModel_1">

      <planItem definitionRef="Stage_1" id="PI_Stage_1"/>
      <planItem definitionRef="HumanTask_6" id="PI_HumanTask_6"/>

      <humanTask name="Capture Applicant Data" id="HumanTask_1"/>
      <humanTask name="Obtain Schufa-Information" id="HumanTask_2"/>
      <humanTask name="Obtain Credit-worthiness" id="HumanTask_3"/>
      <humanTask name="Review Documents" id="HumanTask_4"/>
      <humanTask name="Request Missing Documents" id="HumanTask_5"/>
      <humanTask name="Decide About Loan Application" id="HumanTask_6"/>

      <stage name="Obtain Customer Data" id="Stage_1">
        <planItem definitionRef="HumanTask_1" id="PI_HumanTask_1"/>
        <planItem definitionRef="HumanTask_2" id="PI_HumanTask_2"/>
        <planItem definitionRef="HumanTask_3" id="PI_HumanTask_3"/>
        <planItem definitionRef="HumanTask_4" id="PI_HumanTask_4"/>
        <planItem definitionRef="HumanTask_5" id="PI_HumanTask_5"/>
      </stage>

    </casePlanModel>

  </case>
</definitions>

New Features in 7.2.0-alpha3

In camunda BPM 7.2.0-alpha3 we implemented the basic Case Instance and Plan Item Instance lifecycle. On top of this, the following task types are available:

  • Stage
  • Human Task
  • Process Task
  • Case Task

Using API you can now start and complete cases and perform the lifecycle on the plan items:

  // deploy the case definition
    repositoryService.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/examples/cmmn/loan-application.cmmn")
      .deploy();

    // create a new case instance
    CaseInstance caseInstance = caseService
      .withCaseDefinitionByKey("loanApplication")
      .setVariable("applicantId", "some id ...")
      .create();
    // as a result, the stage and the tasks are enabled.

    // Query for the stage execution
    CaseExecution stageExecution = caseService.createCaseExecutionQuery()
      .caseInstanceId(caseInstance.getId())
      .activityId("PI_Stage_1")
      .singleResult();

    // start the stage
    caseService.withCaseExecution(stageExecution.getId())
      .manualStart();

    // now the "Review Documents" task is enabled:
    CaseExecution reviewDocumentsExecution = caseService.createCaseExecutionQuery()
      .activityId("PI_HumanTask_4")
      .enabled()
      .singleResult();

    // start the review documents task:
    caseService.withCaseExecution(reviewDocumentsExecution.getId())
      .manualStart();

    // complete the review documents task:
    caseService.withCaseExecution(reviewDocumentsExecution.getId())
      .setVariable("allDocumentsObtained", true)
      .complete();

    // ...

Read the Docs

There is some documentation on the CMMN implementation available.

Update!
We have published a getting started guide for CMMN.

Try All Features of Camunda

Related Content

See how Funding Societies is taking advantage of process orchestration to automate their lending process, greatly improving outcomes for their customers.
Process blueprints can now be found on Camunda marketplace! Read on to learn how they can help you and how you can contribute.
Achieve operational superiority with the intelligent backbone of service orchestration. Learn how and why you should orchestrate your services.