A step-by-step learning project to understand the Flowable BPM engine by building a state machine incrementally using Spring Boot.
- Java 21 (Amazon Corretto)
- Spring Boot 3.4.3
- Flowable 7.1.0 (Process Engine)
- PostgreSQL 17 (via Docker)
- Gradle 9.3.1
- Java 21+
- Docker & Docker Compose
- Gradle (or use the included
gradlewwrapper)
docker compose up -dThis starts a PostgreSQL 17 container with a named volume (flowable-pgdata) for data persistence.
./gradlew bootRunThe app starts on http://localhost:8080. Flowable auto-creates its schema tables on first run.
- Spring Boot + Flowable + PostgreSQL wiring
- Flowable auto-configures ProcessEngine, IdmEngine, EventRegistryEngine
- 45 tables created in PostgreSQL for process management
- Created a Leave Request process:
Start → UserTask → End - REST APIs to start a process, list tasks, and complete tasks
- Learned: BPMN XML,
RuntimeService,TaskService, auto-deployment fromresources/processes/
- Added automatic Java logic via
JavaDelegateimplementations - Flow:
Start → ValidateRequest (auto) → ApproveTask (waits) → SendNotification (auto) → End - Learned:
JavaDelegate,DelegateExecution, process variables,flowable:class
POST /api/leave-request
Content-Type: application/json
{
"employeeName": "John",
"reason": "Vacation"
}
GET /api/tasks?assignee=manager
POST /api/tasks/{taskId}/complete
GET /api/process/{processInstanceId}/variables
src/main/
├── java/org/example/flowable/
│ ├── FlowableApplication.java # Main class
│ ├── LeaveRequestController.java # REST APIs
│ └── delegate/
│ ├── ValidateLeaveRequestDelegate.java # Validates leave request
│ └── SendNotificationDelegate.java # Simulates notification
└── resources/
├── application.yaml # DB & Flowable config
└── processes/
└── leave-request.bpmn20.xml # BPMN process definition
Import flowable-leave-request.postman_collection.json into Postman to test all APIs. Run requests 1-5 in order for the full flow.