Skip to main content

Deploy and invoke a BPMN process

This guide demonstrates how to deploy a BPMN 2.0 process model and interact with it from Spring beans. The tutorial covers:
  1. Modeling an executable BPMN 2.0 process
  2. Using the Spring Boot Starter auto-deployment
  3. Creating a process application
  4. Starting a process instance

Model an executable BPMN 2.0 process and deploy it

Begin by modeling an executable process using the Camunda Modeler. The process should resemble the loan approval diagram shown below. The loan approval process
If you are unfamiliar with modeling an executable process, read the Model a Process section of the Quick Start tutorial.
After modeling, save the process file in src/main/resources and refresh your Eclipse project. The process automatically deploys on engine startup when saved to the application classpath.

Create a process application

To declare the process application, add the @EnableProcessApplication annotation to your application class and place an empty processes.xml file in src/main/resources/META-INF.

Start a process instance after the process application has been deployed

Listen for the PostDeployEvent to start the process instance automatically:
@Autowired
private RuntimeService runtimeService;

@EventListener
private void processPostDeploy(PostDeployEvent event) {
  runtimeService.startProcessInstanceByKey("loanApproval");
}
The @Autowired annotation enables dependency injection of ASEE Flow engine services.

Rebuild and test

The task in Tasklist After rebuilding and restarting, you should see Check the request in Tasklist under All tasks.
Catch up: get the sources of Step-3
git clone https://github.com/camunda/camunda-get-started-spring-boot.git
git checkout -f Step-3
Or download as a .zip.