complex event flows in distributed systems...business it business processes automation distributed...
TRANSCRIPT
![Page 1: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/1.jpg)
Complex event flows indistributed systems
@berndruecker With thoughts from http://flowing.io@berndruecker | @martinschimak
![Page 2: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/2.jpg)
3 common hypotheses I check today:
# Events decrease coupling# Orchestration needs to be avoided# Workflow engines are painful
![Page 3: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/3.jpg)
Berlin, Germany
[email protected]@berndruecker
Bernd RueckerCo-founder and Developer Advocate ofCamunda
![Page 4: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/4.jpg)
![Page 5: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/5.jpg)
Simplified example:dash button
Photo by 0xF2, available under Creative Commons BY-ND 2.0 license. https://www.flickr.com/photos/0xf2/29873149904/
![Page 6: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/6.jpg)
Three steps…
![Page 7: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/7.jpg)
Who is involved? Some bounded contexts…
Checkout
Payment
Inventory
Shipment
![Page 8: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/8.jpg)
(Micro-)services
Checkout
Payment
Inventory
Shipment
![Page 9: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/9.jpg)
Autonomous (micro-)services
Checkout
Payment
Inventory
Shipment
Dedicated Application Processes
Dedicated infrastructure
Dedicated Development Teams
![Page 10: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/10.jpg)
Events decrease coupling
![Page 11: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/11.jpg)
Example
Checkout
Payment
Inventory
Shipment
The button blinks if we canship within 24 hours
![Page 12: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/12.jpg)
Request/response: temporal coupling
Checkout
Payment
Inventory
Shipment
RequestResponse
The button blinks if we canship within 24 hours
![Page 13: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/13.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)
![Page 14: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/14.jpg)
Events can decrease coupling*
*e.g. decentral data-management, read models, extract cross-cutting aspects
![Page 15: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/15.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
![Page 16: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/16.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
![Page 17: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/17.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
![Page 18: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/18.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
![Page 19: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/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
![Page 20: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/20.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
Fetch the goodsbefore thepayment
![Page 21: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/21.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
Fetch the goodsbefore thepayment
Customers canpay via invoice
…
![Page 22: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/22.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order placed
Payment received
Goodsshipped
Goodsfetched
Fetch the goodsbefore thepayment
![Page 23: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/23.jpg)
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Fetch the goodsbefore thepayment
Goodsfetched
Order placed
Payment received
Goodsshipped
![Page 24: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/24.jpg)
Photo by born1945, available under Creative Commons BY 2.0 license.
![Page 25: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/25.jpg)
Order
Extract the end-to-end responsibility
Checkout
Payment
Inventory
Shipment
*Commands have an intent about what needs to happen in the future
Order placed
Paymentreceived
Retrievepayment
![Page 26: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/26.jpg)
Commands help to avoid (complex)peer-to-peer event chains
![Page 27: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/27.jpg)
Orchestration needs to be avoided
![Page 28: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/28.jpg)
Smart ESB-like middleware
Checkout
Payment
Inventory
Shipment
Order
Order placed
Payment received
Goodfetched
Goodshipped
![Page 29: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/29.jpg)
Dumb pipes
Checkout
Payment
Inventory
Shipment
Order
Smart endpoints and dumb pipes
Martin Fowler
![Page 30: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/30.jpg)
Danger of god services?
Checkout
Order
A fewsmart god services tellanemic CRUD services what to do
Sam Newmann
Payment
Inventory
Shipment
![Page 31: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/31.jpg)
Danger of god services?
Checkout
Payment
Inventory
Shipment
Order
A fewsmart god services tellanemic CRUD services what to do
Sam Newmann
![Page 32: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/32.jpg)
A god service is only createdby bad API design!
![Page 33: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/33.jpg)
Example
Order Payment
RetrievePayment
![Page 34: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/34.jpg)
Example
Order PaymentCreditCard
RetrievePayment
![Page 35: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/35.jpg)
Example
Order PaymentCreditCard
RetrievePayment
Rejected
![Page 36: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/36.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
![Page 37: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/37.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
Rejected
Paymentreceived
![Page 38: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/38.jpg)
Paymentfailed
Long-running execution
Order Payment
Clients of smart endpoints remains lean.
If the credit card was
rejected, the customer can provide new
details
CreditCard
RetrievePayment
Rejected
Paymentreceived
Smart endpoints are potentially long-running
![Page 39: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/39.jpg)
Persist thing(Entity, Document, Actor, …)
State machine orworkflow engine
Typicalconcerns
DIY = effort, accidentalcomplexity
Scheduling, Versioning, operating, visibility, scalability, …
Handling State
![Page 40: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/40.jpg)
Workflow engines are painful
Complex, proprietary, heavyweight, central, developer adverse, …
![Page 41: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/41.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, …
![Page 42: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/42.jpg)
Workflow engines, state machines
It is
relevantin modern
architectures
![Page 43: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/43.jpg)
CADENCE
Silicon valleyhas recognized
Workflow engines, state machines
![Page 44: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/44.jpg)
![Page 45: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/45.jpg)
CADENCEWorkflow engines, state machines
![Page 46: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/46.jpg)
CADENCE
also at scaleWorkflow engines, state machines
![Page 47: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/47.jpg)
Zeebe.io
![Page 48: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/48.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?“
![Page 49: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/49.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)
![Page 50: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/50.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
![Page 51: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/51.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
![Page 52: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/52.jpg)
BPMNBusiness Process
Model and Notation
ISO Standard
![Page 53: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/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"));
}}
We can attachcode…
![Page 54: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/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"));
}}
…that iscalled whenworkflowinstances pass through
![Page 55: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/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"));
}}
Start instances
![Page 56: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/56.jpg)
Payment
Now you have a state machine!
![Page 57: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/57.jpg)
Payment
Easy to handle time
![Page 59: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/59.jpg)
Synchronous communication
RESTOrder Payment
CreditCard
![Page 60: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/60.jpg)
Synchronous communication
RESTOrder Payment
CreditCard
![Page 61: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/61.jpg)
Synchronous communication
REST
Order PaymentCreditCard
![Page 62: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/62.jpg)
Synchronous communication
RESTOrder Payment
CreditCard
StatefulRetry
![Page 63: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/63.jpg)
Distributedsystems
![Page 64: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/64.jpg)
It is impossible todifferentiate certain
failure scenarios.
Independant ofcommunication style!
Service Provider
Client
![Page 65: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/65.jpg)
Distributed systems introduce complexity you have to tackle!
CreditCard
PaymentREST
![Page 66: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/66.jpg)
Distributed systems introduce complexity you have to tackle!
CreditCard
PaymentREST
![Page 67: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/67.jpg)
Distributedsystems
![Page 68: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/68.jpg)
Distributed transactions using compensation *
Compensation
![Page 69: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/69.jpg)
Relaxed consistency
Temporarily inconsistent
state
But eventually consistent
No Isolation (as in ACID)
![Page 70: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/70.jpg)
https://thenewstack.io/5-workflow-automation-use-cases-you-might-not-have-considered/
![Page 71: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/71.jpg)
<= milliseconds seconds minutes, weeks, …
Business
IT
Business processesautomation
Distributed Transactions
Orchestration
Communication in distributed systems
long runningalways short running short running, but potentially long running
Use cases for workflow automation
![Page 72: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/72.jpg)
Biz Devimprove
communicationimprove
communication
Ops
![Page 73: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/73.jpg)
Biz Dev
Leveragestate machine & workflow engine
Living documentation
Visibility in testing
improvecommunication
improvecommunication
Ops
![Page 74: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/74.jpg)
Visual HTML reports for test cases
![Page 75: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/75.jpg)
Biz Dev
Leveragestate machine & workflow engine
Living documentation
Visibility in testing
Understand and discussbusiness processes
Evaluate optimizationsin-sync with
implementation
improvecommunication
improvecommunication
Ops
![Page 76: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/76.jpg)
Living documentation for long-running behaviour
![Page 77: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/77.jpg)
Biz Dev
Leveragestate machine & workflow engine
Living documentation
Visibility in testing
Understand and discussbusiness processes
Evaluate optimizationsin-sync with
implementation
improvecommunication
improvecommunication
Ops
![Page 78: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/78.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
![Page 79: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/79.jpg)
ProperOperations
Visibility + Context
![Page 80: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/80.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
„
![Page 81: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/81.jpg)
Workflows live inside service boundaries
![Page 82: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/82.jpg)
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
![Page 83: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/83.jpg)
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
![Page 84: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/84.jpg)
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
![Page 85: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/85.jpg)
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
![Page 86: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/86.jpg)
…
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
![Page 87: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/87.jpg)
Lightweight workflow engines aregreat* – don‘t DIY
*e.g. enabling potentially long-running services, solving harddeveloper problems, can run decentralized
![Page 88: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/88.jpg)
Sales-Order & Order-Fulfillment
via Camunda
for every order worldwide
(Q2 2017: 22,2 Mio)
![Page 89: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/89.jpg)
Code example & live demo
InventoryPaymentOrder ShippingCheckout Monitor
https://github.com/flowing/flowing-retail/
Human Tasks
H2 H2
![Page 90: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/90.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, important capabilities need a home
# Workflow engines are painful: some of themlightweight engines are easy to use and can run decentralized,they solve hard developer problems, don‘t DIY
![Page 91: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/91.jpg)
Thank you!
![Page 92: Complex event flows in distributed systems...Business IT Business processes automation Distributed Transactions Orchestration Communication in distributed systems always short running](https://reader034.vdocuments.mx/reader034/viewer/2022042222/5ec947a817c7d3625d7f6e77/html5/thumbnails/92.jpg)
[email protected]@berndruecker
https://bernd-ruecker.com
https://blog.bernd-ruecker.com
https://github.com/flowing
https://www.infoq.com/articles/events-workflow-automation
With thoughts from http://flowing.io@berndruecker | @martinschimak
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/