master the flow of microservices - because your business is more complex than
TRANSCRIPT
![Page 1: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/1.jpg)
@berndruecker#VoxxedVienna
Because your business ismore complex than *
* Some big video streaming company
With thoughts from http://flowing.io@berndruecker | @martinschimak
![Page 2: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/2.jpg)
FAMGA
![Page 3: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/3.jpg)
FANG
![Page 4: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/4.jpg)
Tech stack
https://www.slideshare.net/RaminForood/platform-data-technologies-at-netflix
Noorchestration.
![Page 5: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/5.jpg)
Orchestration
![Page 6: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/6.jpg)
![Page 7: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/7.jpg)
Netflix recognized challenges in orchestration
![Page 8: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/8.jpg)
Let‘s do some groundwork before wedive into orchestration…
![Page 9: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/9.jpg)
System complexity increases dramatically
Warehouse System
LogisticsPlatform
TaxiSystem
TravelPlatform
Insurance System
Insurance Platform
Heating with temperature
sensor
Smart Heating(Cloud
controlled)
…
…
![Page 10: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/10.jpg)
Helpful paradigms
Microservices Event Driven & Reactive Domain Driven Design
![Page 11: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/11.jpg)
Microservices
• Independent components
• Independent deployments
• Decoupling between components
• Dedicated teams to fight conways law
• Autonomy of technology decisions
• Avoid horizontal team boundaries
• New DevOps paradigms
Microservice
Microservice
Microservice
Monolith
A
B
C
A
B
C
![Page 12: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/12.jpg)
Event driven microservices
Microservice Microservice Microservice
A B C
Eventbus
![Page 13: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/13.jpg)
Communication via events
Microservice Microservice
A C
Eventbus
Event
event namepayload
no receipient
![Page 14: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/14.jpg)
Communication via Events
Microservice Microservice
A C
Eventbus
Event
Does not know
about C
Does not know
about A
![Page 15: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/15.jpg)
Compare to SOA
Service Service
A C
ESB
„smart endpoints and dumb pipes”
![Page 16: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/16.jpg)
Value proposition: fight conway, keep agility and ease changes
Microservice Microservice
A C
Eventbus
![Page 17: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/17.jpg)
Yeah.
![Page 18: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/18.jpg)
Example: Simple order handling
![Page 19: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/19.jpg)
pay receive
shipment
place
order
I want to buy this!
I am happy!
![Page 20: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/20.jpg)
Sample Microservices
Inventory Service
Handles Stock, Reserviations andphysical handlingof goods
Payment Service Handles Payment
Shipping Service
Manage shipments & labels for logisticproviders
![Page 21: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/21.jpg)
Eventflow
Order Placed
Payment Received
GoodsPicked
GoodsShipped
InventoryPayment ShippingShop
![Page 22: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/22.jpg)
Implementation
![Page 23: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/23.jpg)
Let‘s zoom in the payment service
Payment Serviceorderplaced
paymentreceived
![Page 24: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/24.jpg)
Let‘s zoom in the payment service
Payment Serviceorderplaced
paymentreceived
The payment servicehas to listen to
„order placed“ event
![Page 25: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/25.jpg)
De-coupling?
Payment Service
orderplaced
servicefullfilled
…
Whenever a new service requirespayment, the payment has to bechanged
Payment has to know all possibleevents that trigger a payment
subscriptionconfirmed
![Page 26: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/26.jpg)
Martin Fowler also recognized
Event notification is nice because it implies a low level of coupling, and is pretty simple to set up. It can become problematic, however, if there really is a logical flow that runs over various event notifications. The problem is that it can be hard to see such a flow as it's not explicit in any program text. Often the only way to figure out this flow is from monitoring a live system. This can make it hard to debug and modify such a flow. 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 27: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/27.jpg)
Event Command Transformation
Payment Servicedo
paymentorderplaced Transformation
CommandSomething has to happenin the future1 recipient
EventSomething has happendin the past0..n recipients
![Page 28: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/28.jpg)
This calls for an order service
Payment servicedo
paymentorderplaced Order service
![Page 29: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/29.jpg)
Microservices
Inventory service
Payment service
Order service
Does eventcommandtransformationfor orders
Shipping service
![Page 30: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/30.jpg)
Event Command Transformation
dopayment
orderplaced
OrderService
paymentreceived
pickgoods
goodspicked
shipgoods
goodsshipped
orderdelivered
OrderService
OrderService
OrderService
![Page 31: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/31.jpg)
Smeels like a central ESB?
http://apsblog.burtongroup.com/2009/01/soa-is-dead-long-live-services.html
![Page 32: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/32.jpg)
No! Far from it!
Inventory service
Payment service
Order serviceMight beimplemented in simple Java
Shipping service
![Page 33: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/33.jpg)
Order service does the orchestration
![Page 34: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/34.jpg)
Implementation (with event command transformation)
![Page 35: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/35.jpg)
Some things in life are slow
dopayment
orderplaced
paymentreceived
pickgoods
goodspicked
shipgoods
goodsshipped
orderdelivered
OrderService
Long Running
Long Running
Long Running
Long Running
![Page 36: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/36.jpg)
You also have to handle state.
![Page 37: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/37.jpg)
Bernd Rücker
Co-founder Camunda> 10+ years workflow
http://bernd-ruecker.com/[email protected]
Camunda
Open source vendorBerlin + San Francisco
> 60 employeesNo venture capital
www.camunda.org
![Page 38: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/38.jpg)
The 7 sins of workflow and Java
Homegrownengine
No engine Wrong engine
4
6
5
7
All sins: http://blog.bernd-ruecker.com/
Zero-code suites
Wrong usage
![Page 39: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/39.jpg)
ToolsState Visibility
[ Orchestration | Workflow | BPM ] Engine
![Page 40: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/40.jpg)
Order example in BPMN*
*BPMN = ISO standard for modeling and execution
in thiscontextmeans:
![Page 41: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/41.jpg)
Payment example
![Page 42: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/42.jpg)
Pa
ym
en
t se
rvic
e
Orchestration is part of the microservices!O
rde
r se
rvic
e
Eventbus
![Page 43: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/43.jpg)
It does not have to be one monlithic process
Hint: This might work well if your company is structured tohave this one clear process owner for this process.
![Page 44: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/44.jpg)
Microservice vs. BPM community
![Page 45: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/45.jpg)
Requirement: lightweight and embeddable engine
Engine must be
• easy to use
• developer friendly
also in the scope of microservices
• technically
• license model
Payment service
Order service
engine
engine
…
…
…
…
engine
![Page 46: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/46.jpg)
Yes – that‘s possible!
![Page 47: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/47.jpg)
LiveDemo
![Page 48: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/48.jpg)
Architecture
Inventoryservice
Payment service
Order service
Shippingservice
H2
Shop Monitor
Camunda Webapp
on Tomcat
for demo in single Java VM for simplicity
![Page 49: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/49.jpg)
Screenshots
![Page 50: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/50.jpg)
Screenshots
![Page 51: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/51.jpg)
And synchronous communication?
![Page 52: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/52.jpg)
Communication between Microservices
Microservice Microservice
Microservice
A B
C
e.g. REST
You need to handle outtages (wait, retry, …)
![Page 53: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/53.jpg)
Change scenarios
![Page 54: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/54.jpg)
We want to reservegoods even before wereceived the payment.
![Page 55: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/55.jpg)
Changes
Inventory service
Payment service
Order service
Shipping service
must providereservation
servicereserve goods at right moment
![Page 56: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/56.jpg)
BPMN
![Page 57: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/57.jpg)
Changes
Inventory service
Payment service
Order service
Shipping service
must providereservation
servicereserve goods at right moment
Listen to goodsreserved insteadof order created.
Listen to ordercreated.
With event commandtransformation
Without
![Page 58: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/58.jpg)
VIP customers can order with invoice (and pay later)
![Page 59: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/59.jpg)
Required changes
Inventory service
Payment service
Order service
Shipping service
Invoice service
skip payment, but add open invoice
![Page 60: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/60.jpg)
Responsibility of order service
![Page 61: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/61.jpg)
Required changes
Inventory service
Payment service
Order service
Shipping service
Invoice service
skip payment, but add open invoice
Listen to ordercreated VIP or
payment received(non VIP).
Listen to ordercreated (VIP).
![Page 62: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/62.jpg)
We need more cool stuff – can BPMN do this?
![Page 63: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/63.jpg)
Compensation
…in case of errors in error handling pay the
money back to thecustomer
![Page 64: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/64.jpg)
Timeouts…after two weeks
pricing is not bindingany more
![Page 65: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/65.jpg)
When a customer cancels, we want to win him back!
![Page 66: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/66.jpg)
Required changes
Inventory service
Payment service
Order service
Shipping service
Listen toappropriate
events, no changeanywhere else
Winback service
BPM monolith
![Page 67: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/67.jpg)
Summary
• Microservices and event driven architecture go well together
• You need an event command transformation
• If the translation is stateful, consider using an appropriate engine
• Modern lightweight engines foster and not hinder these architectures
![Page 68: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/68.jpg)
Is it for me?Isn‘t all of that just for FANG?
![Page 72: Master the flow of microservices - because your business is more complex than](https://reader031.vdocuments.us/reader031/viewer/2022030306/58d0fc411a28abc00b8b6433/html5/thumbnails/72.jpg)
Thank you! Any questions?