![Page 1: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/1.jpg)
Complex event flows indistributed systems
@berndruecker
![Page 2: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/2.jpg)
3 common hypotheses I check today:
# Events decrease coupling# Orchestration needs to be avoided# Workflow engines are painful
@berndruecker
![Page 3: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/3.jpg)
Warning:Contains Opinion
![Page 4: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/4.jpg)
Berlin, Germany
[email protected]@berndruecker
Bernd RueckerCo-founder and Chief Technologist ofCamunda
![Page 5: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/5.jpg)
![Page 6: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/6.jpg)
Simplified example:dash button
Photo by 0xF2, available under Creative Commons BY-ND 2.0 license. https://www.flickr.com/photos/0xf2/29873149904/
@berndruecker
![Page 7: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/7.jpg)
Three steps…@berndruecker
![Page 8: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/8.jpg)
Who is involved? Some bounded contexts…
Checkout
Payment
Inventory
Shipment
@berndruecker
![Page 9: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/9.jpg)
(Micro-)services
Checkout
Payment
Inventory
Shipment
@berndruecker
![Page 10: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/10.jpg)
Autonomous (micro-)services
Checkout
Payment
Inventory
Shipment
Dedicated Application Processes
Dedicated infrastructure
Dedicated Development Teams
@berndruecker
![Page 11: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/11.jpg)
Events decrease coupling
@berndruecker
![Page 12: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/12.jpg)
Example
Checkout
Payment
Inventory
Shipment
The button blinks if we canship within 24 hours
@berndruecker
![Page 13: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/13.jpg)
Request/response: temporal coupling
Checkout
Payment
Inventory
Shipment
RequestResponse
The button blinks if we canship within 24 hours
@berndruecker
![Page 14: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/14.jpg)
Temporal decoupling with events and read models
Checkout
Payment
Inventory
Shipment
GoodStored
Read Model
GoodFetched
The button blinks if we canship within 24 hours
*Events are facts about what happened (in the past)
@berndruecker
![Page 15: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/15.jpg)
OrderPlaced
PaymentReceived
GoodsFetched
Notification
Checkout
Payment
Inventory
Shipment
Event-driven architecture@berndruecker
![Page 16: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/16.jpg)
Events can decrease coupling*
*e.g. decentral data-management, read models, extract cross-cutting aspects
@berndruecker
![Page 17: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/17.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
@berndruecker
![Page 18: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/18.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
@berndruecker
![Page 19: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/19.jpg)
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
![Page 20: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/20.jpg)
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
![Page 21: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/21.jpg)
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
![Page 22: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/22.jpg)
Monitoring Workflows Across Microservices
https://www.infoq.com/articles/monitor-workflow-collaborating-microservices
@berndruecker
![Page 23: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/23.jpg)
Typical approachesDistributed Tracing
Data Lake / Event Monitoring
Process Mining
Process Tracking
@berndruecker
![Page 24: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/24.jpg)
Stefan Tilkov: Microservice Patterns & Antipatterns - MicroXchg 2018
@berndruecker
![Page 25: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/25.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
Fetch the goodsbefore thepayment
@berndruecker
![Page 26: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/26.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Fetch the goodsbefore thepayment
Goodsfetched
Order placed
Payment received
Goodsshipped
@berndruecker
![Page 27: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/27.jpg)
Photo by born1945, available under Creative Commons BY 2.0 license.
@berndruecker
![Page 28: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/28.jpg)
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and Pedobear19 / CC BY-SA 4.0
@berndruecker
![Page 29: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/29.jpg)
„Challenges?“
Source: Microservices orchestration survey, July 2018, 354 responses
https://camunda.com/microservices-orchestration-survey-results-2018/
@berndruecker
![Page 30: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/30.jpg)
Order
Extract the end-to-end responsibility
Checkout
Payment
Inventory
Shipment
*Commands have an intent about what needs to happen in the future
Paymentreceived
Order placed
Retrievepayment
@berndruecker
![Page 31: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/31.jpg)
Order
It is about where to decide about the coupling!
Checkout
Payment
Inventory
Shipment
Order placed
Retrievepayment
Order decides. to listen to the event. to issue the command
@berndruecker
![Page 32: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/32.jpg)
Order
It is about where to decide about the coupling!
Checkout
Payment
Inventory
Shipment
Order placed
Retrievepayment
It can still be messaging!
@berndruecker
![Page 33: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/33.jpg)
Commands help to avoid (complex)peer-to-peer event chains
@berndruecker
![Page 34: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/34.jpg)
Orchestration needs to be avoided
@berndruecker
![Page 35: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/35.jpg)
Smart ESB-like middleware
Checkout
Payment
Inventory
Shipment
Order
Order placed
Payment received
Goodfetched
Goodshipped
@berndruecker
![Page 36: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/36.jpg)
Dumb pipes
Checkout
Payment
Inventory
Shipment
Order
Smart endpoints and dumb pipes
Martin Fowler
@berndruecker
![Page 37: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/37.jpg)
Danger of god services?
Checkout
Order
A fewsmart god services tellanemic CRUD services what to do
Sam Newmann
Payment
Inventory
Shipment
@berndruecker
![Page 38: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/38.jpg)
Danger of god services?
Checkout
Payment
Inventory
Shipment
Order
A fewsmart god services tellanemic CRUD services what to do
Sam Newmann
@berndruecker
![Page 39: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/39.jpg)
A god service is only createdby bad API design!
@berndruecker
![Page 40: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/40.jpg)
Example
Order Payment
RetrievePayment
@berndruecker
![Page 41: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/41.jpg)
Example
Order PaymentCreditCard
RetrievePayment
@berndruecker
![Page 42: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/42.jpg)
Example
Order PaymentCreditCard
RetrievePayment
Rejected
@berndruecker
![Page 43: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/43.jpg)
Example
Order Payment
If the creditcard was
rejected, thecustomer canprovide new
details
CreditCard
RetrievePayment
RejectedRejected
@berndruecker
![Page 44: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/44.jpg)
Example
Order Payment
Client of dumb endpoints easily become a god services.
If the creditcard was
rejected, thecustomer canprovide new
details
CreditCard
RetrievePayment
RejectedRejected
@berndruecker
![Page 45: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/45.jpg)
Paymentfailed
Who is responsible to deal with problems?
Order Payment
If the credit card was
rejected, the customer can provide new
details
CreditCard
RetrievePayment
RejectedPaymentreceived
@berndruecker
![Page 46: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/46.jpg)
Paymentfailed
Long running services
Order PaymentCreditCard
RetrievePayment
RejectedPaymentreceived
Smart endpoints are potentially long-running
@berndruecker
![Page 47: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/47.jpg)
Persist thing(Entity, Actor, …)
State machine orworkflow engine
Typicalconcerns
DIY = effort, accidentalcomplexity
Scheduling, Versioning, operating, visibility, scalability, …
Handling State
@berndruecker
![Page 48: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/48.jpg)
Workflow engines are painful
Complex, proprietary, heavyweight, central, developer adverse, …
@berndruecker
![Page 49: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/49.jpg)
Avoid the wrong tools!
Death by properties panel
Low-code is great!(You can get rid
of your developers!)
Complex, proprietary, heavyweight, central, developer adverse, …
@berndruecker
![Page 50: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/50.jpg)
Workflow engines, state machines
It is
relevantin modern
architectures
@berndruecker
![Page 51: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/51.jpg)
CADENCE
Silicon valleyhas recognized
Workflow engines, state machines
@berndruecker
![Page 52: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/52.jpg)
CADENCEWorkflow engines, state machines
@berndruecker
![Page 53: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/53.jpg)
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"));
}}
What do I mean by„leightweight?“
@berndruecker
![Page 54: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/54.jpg)
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"));
}}
Build enginein one line ofcode(using in-memory H2)
@berndruecker
![Page 55: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/55.jpg)
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"));
}}
Define flowe.g. in Java DSL
@berndruecker
![Page 56: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/56.jpg)
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"));
}}
Define flowe.g. in Java DSL
@berndruecker
![Page 57: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/57.jpg)
BPMNBusiness Process
Model and Notation
ISO Standard
@berndruecker
![Page 58: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/58.jpg)
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 attachcode…
@berndruecker
![Page 59: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/59.jpg)
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 iscalled whenworkflowinstances pass through
@berndruecker
![Page 60: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/60.jpg)
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
![Page 61: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/61.jpg)
Payment
Now you have a state machine!@berndruecker
![Page 62: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/62.jpg)
Payment
Easy to handle time@berndruecker
![Page 63: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/63.jpg)
Distributedsystems
@berndruecker
![Page 64: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/64.jpg)
Example with synchronous communication
RESTOrder Payment
CreditCard
@berndruecker
![Page 65: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/65.jpg)
Example with synchronous communication
RESTOrder Payment
CreditCard
@berndruecker
![Page 66: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/66.jpg)
Example with synchronous communication
REST
Order PaymentCreditCard
@berndruecker
![Page 67: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/67.jpg)
Example with synchronous communication
RESTOrder Payment
CreditCard
StatefulRetry
@berndruecker
![Page 68: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/68.jpg)
Works also for asynchronous communication
Order PaymentCreditCard
Monitor Timeouts
@berndruecker
![Page 69: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/69.jpg)
Distributedsystems
@berndruecker
![Page 70: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/70.jpg)
It is impossible todifferentiate certain
failure scenarios:
Independant ofcommunication style!
Service Provider
Client
@berndruecker
![Page 71: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/71.jpg)
Distributed systems introduce complexity you have to tackle!
CreditCard
PaymentREST
@berndruecker
![Page 72: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/72.jpg)
Distributed systems introduce complexity you have to tackle!
CreditCard
PaymentREST
The service can belong running.You get a better API and less gods
@berndruecker
![Page 73: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/73.jpg)
Workflows live inside service boundaries@berndruecker
![Page 74: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/74.jpg)
No BPM(N) monoliths
https://blog.bernd-ruecker.com/avoiding-the-bpm-monolith-when-using-bounded-contexts-d86be6308d8
@berndruecker
![Page 75: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/75.jpg)
Pat Helland
“
Distributed Systems Guru Worked at Amazon, Microsoft & Salesforce
@berndruecker
![Page 76: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/76.jpg)
Pat Helland
Grown-Ups Don’t Use Distributed Transactions
“
Distributed Systems Guru Worked at Amazon, Microsoft & Salesforce
@berndruecker
![Page 77: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/77.jpg)
Distributed transactions using compensation *
Compensation
@berndruecker
![Page 79: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/79.jpg)
Biz Dev
Leveragestate machine & workflow engine
Living documentation
Visibility in testing
improvecommunication
improvecommunication
Ops
@berndruecker
![Page 80: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/80.jpg)
Visual HTML reports for test cases@berndruecker
![Page 81: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/81.jpg)
Living documentation for long-running behaviour@berndruecker
![Page 82: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/82.jpg)
ProperOperations
Visibility + Context
@berndruecker
![Page 83: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/83.jpg)
Biz Dev
Leveragestate machine & workflow engine
Living documentation
Visibility in testing
Operate with visibilityand context
Understand and discussbusiness processes
Evaluate optimizationsin-sync with
implementation
improvecommunication
improvecommunication
Ops
@berndruecker
![Page 84: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/84.jpg)
Monitoring Workflows Across Microservices
https://www.infoq.com/articles/monitor-workflow-collaborating-microservices
@berndruecker
![Page 85: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/85.jpg)
Tracking
Checkout Inventory
Payment Shipment
Event Bus
Workflow Engine
https://www.confluent.io/kafka-summit-sf18/the_big_picture @berndruecker
![Page 86: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/86.jpg)
Journey towards more orchestration@berndruecker
![Page 87: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/87.jpg)
Vodafone, Liongate & WDWPresented at CamundaCOn Berlin 2018
![Page 88: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/88.jpg)
Before mapping processes explicitly with BPMN, the truth was buried in the code and nobody knew what was going on.
Jimmy Floyd, 24 Hour Fitnesse
„
@berndruecker
![Page 89: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/89.jpg)
…It addresses one of the core issues in a distributed microservices architecture—where is the source of truth for the coordinated interaction of the entire system?…the system we are replacing uses a complex peer-to-peer choreography that requires reasoning across multiple codebases to understand.
https://medium.com/@sitapati/node-js-client-for-zeebe-microservices-orchestration-engine-72287e4c7d94
Josh WulfCredit Sense
@berndruecker
![Page 90: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/90.jpg)
Lightweight workflow engines aregreat – don‘t DIY*
*e.g. enabling potentially long-running services, solving harddeveloper problems, can run decentralized
@berndruecker
![Page 91: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/91.jpg)
Sales-Order & Order-Fulfillment
via Camunda
for every order worldwide
(Q2 2017: 22,2 Mio)
@berndruecker
![Page 92: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/92.jpg)
Code, code, code…@berndruecker
![Page 93: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/93.jpg)
Event-driven example
InventoryPaymentOrder ShippingCheckout Monitor
https://github.com/berndruecker/flowing-retail/
Human Tasks
H2 H2
@berndruecker
![Page 94: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/94.jpg)
# Events decrease coupling: sometimesread-models, but no complex peer-to-peer event chains!
# Orchestration needs to be avoided: sometimesno ESB, smart endpoints/dumb pipes, balance orchestration and choreography
# Workflow engines are painful: some of themlightweight engines are easy to use and can run decentralized,they solve hard developer problems, don‘t DIY
@berndruecker
![Page 95: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/95.jpg)
Thank you!
@berndruecker
![Page 96: Complex event flows in distributed systems · Complex event flows in distributed systems @berndruecker. 3 common hypotheses I check today: ... Peer-to-peer event chains Checkout Payment](https://reader030.vdocument.in/reader030/viewer/2022040611/5ed5fc09e6c7924a85500f6f/html5/thumbnails/96.jpg)
[email protected]@berndruecker
https://berndruecker.io
https://medium.com/berndruecker
https://github.com/berndruecker
https://www.infoq.com/articles/events-workflow-automation
Contact:
Slides:
Blog:
Code:
https://www.infoworld.com/article/3254777/application-development/3-common-pitfalls-of-microservices-integrationand-how-to-avoid-them.html
https://thenewstack.io/5-workflow-automation-use-cases-you-might-not-have-considered/