Skip to content
BPMN model API written in Java.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
src chore(bpmn): update license headers Apr 9, 2019
NOTICE chore(bpmn): update license headers Apr 9, 2019
README.asciidoc chore(readme): update license link Apr 9, 2019


camunda BPMN model API

The camunda BPMN model API is a simple, lightweight Java library for parsing, creating and editing BPMN 2.0 XML files. It is licensed under the Apache 2.0 license.


camunda BPMN model can be used standalone, independenly of camunda BPM platform / process engine.


Fluent builder API

To easily create simple BPMN 2.0 processes we provide the fluent builder API. It supports most BPMN 2.0 elements and allows you to set attributes and add some child elements. The following process is deployable and can be executed by the camunda BPM platform.

BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("processId")

For more complex examples see the docs, the tests in or this example.

Create an empty BPMN model

You can easily create a new empty BPMN model.

BpmnModelInstance modelInstance = Bpmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);

Validate a BPMN model

At any time you can validate your model against the BPMN 2.0 specification.

BpmnModelInstance modelInstance = [...]

Creating a Process using the full API

The fluent API is usually a good choice for creating a new BPMN process. However, not all elements supported by the model are exposed through fluent builders and the fluent api may not be the appropriate API style for all usecases. In such cases, the full API can be used for creating a process model. The following code creates a simple Process as a jUnit4 test using the full API:

Find elements inside the model

// find element instance by ID
ModelElementInstance elementInstance = modelInstance.getModelElementById("start");

// find all elements of the type task
ModelElementType taskType = modelInstance.getModel().getType(Task.class);
Collection<ModelElementInstance> elementInstances = modelInstance.getModelElementsByType(taskType);

Save the BPMN model

The model API allows you to save your model in several ways

// create BPMN model
BpmnModelInstance modelInstance = [...]

// convert to string
String xmlString = Bpmn.convertToString(modelInstance);

// write to output stream
OutputStream outputStream = new OutputStream(...);
Bpmn.writeModelToStream(outputStream, modelInstance);

// write to file
File file = new File(...);
Bpmn.writeModelToFile(file, modelInstance);

Planned features

  • extended validation support like integrity checks for broken references


What is BPMN 2.0?

Which Java (JRE) Version is required?

Java JRE 1.6+ is required. We test camunda BPMN model API on Oracle and IBM JVMs.

Does this API support all BPMN 2.0 Elements?

No, but support is already quite extensive. See org.camunda.bpm.model.bpmn.instance for a list of currently supported elements.


The source files in this repository are made available under the Apache License, Version 2.0.

You can’t perform that action at this time.