12. public static void main(String[] args) {
ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
engine.getRepositoryService().createDeployment() //
.addModelInstance("flow.bpmn", Bpmn.createExecutableProcess("flow")
.startEvent()
.serviceTask("Step1").camundaClass(SysoutDelegate.class)
.serviceTask("Step2").camundaClass(SysoutDelegate.class)
.endEvent()
.done()
).deploy();
engine.getRuntimeService().startProcessInstanceByKey(
"flow", Variables.putValue("city", "New York"));
}
public class SysoutDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("Hello " + execution.getVariable("city"));
}
}
We can attach
code…
@berndruecker
13. public static void main(String[] args) {
ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
engine.getRepositoryService().createDeployment() //
.addModelInstance("flow.bpmn", Bpmn.createExecutableProcess("flow")
.startEvent()
.serviceTask("Step1").camundaClass(SysoutDelegate.class)
.serviceTask("Step2").camundaClass(SysoutDelegate.class)
.endEvent()
.done()
).deploy();
engine.getRuntimeService().startProcessInstanceByKey(
"flow", Variables.putValue("city", "New York"));
}
public class SysoutDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("Hello " + execution.getVariable("city"));
}
}
…that is
called when
workflow
instances pass
through
@berndruecker
14. public static void main(String[] args) {
ProcessEngine engine = new StandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
engine.getRepositoryService().createDeployment() //
.addModelInstance("flow.bpmn", Bpmn.createExecutableProcess("flow")
.startEvent()
.serviceTask("Step1").camundaClass(SysoutDelegate.class)
.serviceTask("Step2").camundaClass(SysoutDelegate.class)
.endEvent()
.done()
).deploy();
engine.getRuntimeService().startProcessInstanceByKey(
"flow", Variables.putValue("city", "New York"));
}
public class SysoutDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
System.out.println("Hello " + execution.getVariable("city"));
}
}
Start
instances
@berndruecker
15. Architecture choices
Your app or service
WF Engine
Your app or service
WF
Engine
WF Engine
logic or
service
WF Engine
logic or
service
Call,
send message,
connector, …
(Long-)Polling
Pub/Sub
PushEmbedded
Server Pull
vs vs
See also https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
18. <= milliseconds seconds minutes, weeks, …
Business
IT
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
19. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
21. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
22.
23.
24. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
Communication in
distributed systems
26. Distributed systems
“A distributed system is one in which the failure of a computer
you didn’t even know existed can render your own computer unusable.”
Lamport
36. Embedded, Push
Your app or service
WF Engine
logic or
service
Call,
send message,
connector, …
Push
Embedded
Raises questions around
Threads,
Transactions, …
38. Aspects to consider
Camunda Spring State Machine
Workflow Definition BPMN 2.0
(graphical, XML, Model API)
Java API, UML-Generator
Visual? YES No
Tooling Modeler, Cockpit, Optimize -
Storage Runtime RDMS up to you
Storage History RDMS -
Scalability Stateless Engine,
RDMS is limit,
Sharding possible
up to you
Fault tolerance If RDMS is HA up to you
Supported programming
languages
Java, REST,
Language Clients (JS, C#)
Java
HOMEWORK
40. Long running services*
provide a better API!
@berndruecker
* Services that have the capability to keep state and thus can be potentially long running
44. Example
Order Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
45. Example
Order Payment
Client of dumb endpoints easily become a god services.
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
46. Payment
failed
Who is responsible to deal with problems?
Order Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
48. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
Communication in
distributed systems
49. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
Communication in
distributed systems
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
Orchestration
57. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
58. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
59. The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
62. What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and Pedobear19 / CC BY-SA 4.0
@berndruecker
63. Order
Extract the end-to-end responsibility
Checkout
Payment
Inventory
Shipment
*Commands have an intent about
what needs to happen in the future
Payment
received
Order
placed
Retrieve
payment
@berndruecker
64. Order
It still can be messaging!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
@berndruecker
78. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
Communication in
distributed systems
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
Orchestration
79. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
Communication in
distributed systems
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
Orchestration
Consistency
87. Flow language is important!
Think of more complicated scenarios…
88. Architecture for Serverless
WF Engine
(Long-)Polling Push
Pull
function
Server
glue layer
logic or
service
Easy to hop
over firewalls
89. Aspects to consider
Camunda AWS Step Functions
Workflow
Definition
BPMN 2.0 (graphical, XML,
Model API)
JSON
Visual? YES Simple, only runtime
Tooling Modeler, Cockpit,
Optimize
-
Scalability Stateless Engine
With RDMS
Up to ~ 1k state
transitions / sec*
Deployment Embedded or Server Cloud (Server)
Licensing ASL Proprietary
HOMEWORK
91. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
Distributed
Transactions
Orchestration
Communication in
distributed systems
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
92. <= milliseconds seconds minutes, weeks, …
Business
IT
Business processes
automation
Distributed
Transactions
Decision
Automation
Orchestration
Communication in
distributed systems
long runningalways short running short running, but
potentially long running
Use cases for workflow automation
100. My personal pro-tip for a shortlist ;-)
OSS Workflow or
Orchestration Engines
Stack Vendors,
Pure Play BPMS
Low Code Platforms
Homegrown frameworks
to scratch an itch
Integration Frameworks
Cloud Offerings
Data
Pipelines
Camunda & Zeebe