Camunda Transaction Boundaries Explained Visually
Many Camunda production issues come from one misunderstanding:
“Each BPMN task runs separately.”
No — by default Camunda executes multiple BPMN steps inside one database transaction.
That means one failure can roll back multiple steps.
Understanding transaction boundaries is the key to fixing:
stuck processes
optimistic locking
duplicate executions
random rollbacks
What is a Transaction Boundary?
A transaction boundary is a checkpoint where the process state is saved in DB.
Without it → everything runs in one transaction
With it → process resumes safely later
Default Execution (No Boundary)
Camunda runs until a wait state appears.
What is a Wait State?
User Task
Receive Task
Timer
External Task
At these points, state is stored automatically.
The Problem — Rollback Chain Reaction
Example:
Service Task A → Service Task B → Service Task C
If C fails → A & B rollback too.
This causes:
duplicate API calls
payment charged twice
inconsistent business data
Async Before Creates Boundary
Async Before forces a save before execution.
Now only the failing step retries — not previous ones.
Async After Creates Boundary After Execution
Used mainly before gateways and parallel flows.
Optimistic Locking Problem
Occurs when two executions update same process instance.
Without boundary → exception loop
With async → safe retry
Internal Engine Behavior
Camunda does:
Execute → Flush DB → Commit → Continue
Async splits it into multiple safe commits.
Where Boundaries Should Exist
| Location | Why |
|---|---|
| Before external call | Prevent duplicates |
| Before gateway | Avoid optimistic locking |
| Parallel gateway | Concurrency safety |
| Long service task | Prevent blocking |
Common Mistake
Adding async only at process start
Does nothing for internal rollback chains.
Architecture Rule
Every remote call must have a transaction boundary.
📚 Recommended Reading
Improve reliability:
👉 https://shikhanirankari.blogspot.com/search/label/English
Especially:
Final Advice
BPMN controls flow
Transactions control safety
If you design boundaries correctly, your process becomes resilient.
Comments
Post a Comment