Workflow Automation in
Microservices Architectures
@NiallDeehan
Who I am?
Niall Deehan Neil De Han
What? Why?
Microservices & Workflow Automation
How?
t
What? Why?
Microservices & Workflow Automation
How?
t
Microservices…
Service
B
Some
Service
Some
Service Some
Service
Service
C
Service
A
Service
D
Monolith
Functionality
A
Functionality
B
Functionality
C
Functionality
D
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Microservices…
Challenges
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License / CC BY-SA 4.0
How do we know whats going on?
Photo by pxhere, available under Creative Commons CC0 1.0 License.
Example: http://github.com/berndruecker/flowing-retail
Checkout
Payment
Inventory
Shipment
?
Order
Checkout
Payment
Inventory
Shipment
An „orchestration process“?
Every workflow must be
owned by one microservice.
No exceptions!
Order
Checkout
Payment
Inventory
Shipment
Otherwise you end up with SOA again!
Checkout
Payment
Inventory
Shipment
Order
No BPM(N) monoliths
https://blog.bernd-ruecker.com/avoiding-the-bpm-monolith-when-using-bounded-contexts-d86be6308d8
Workflows live inside service boundaries
Order
Placed
Payment
Received
Goods
Fetched
Notification
Order
Checkout
Payment
Inventory
Shipment
Event-driven architecture
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
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
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
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
Finding the right balance
33
Observe Microservice Paradigms
● Loose Coupling
● Autonomy
● Event Collaboration
Ensure Flow Manageability
• End-To-End Visibility
• Meet Business Process SLA
• Support Continuous Process
Improvement
Tracking
Checkout Inventory
Payment Shipment
Event Bus
Workflow
Engine
https://www.confluent.io/kafka-summit-sf18/the_big_picture
Tracking + BI
Checkout Inventory
Payment Shipment
Event Bus
Workflow
Engine
Camunda
Optimize
Other reporting
/ BIO solutions
But you can start acting upon certain events
Order
Checkout
Payment
Inventory
Shipment
Orchestration
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
Fetch the goods
before the
payment
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Fetch the goods
before the
payment
Goods
fetched
Order
placed
Payment
received
Goods
shipped
Orchestration makes it easy to change the flow
Order
Commands vs. Events
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
Order
It is about where to decide about the coupling!
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
Order decides
. to listen to the event
. to issue the command
Microservices =
Distributed systems
Order
Checkout
Payment
Inventory
Shipment
Stateful orchestration
This orchestration
requires state
BPMN supports integration use cases
Aggregator
Re-Sequencer
Combined with timeouts:
BPMN supports integration use cases
Compensation
Order
Checkout
Payment
Inventory
Shipment
Orchestration
Order
Checkout
Payment
Inventory
Shipment
Orchestration
Orchestration is independant of
communication channel!
This might be REST, Messaging,
Event-Bus, …
Workflow Engine
Typical ways of communication
Checkout
Payment
Order
Shipment Checkout
Payment
Order
Shipment
Checkout
PaymentOrder
Shipment
Message/Event Bus REST-ish
Workflow Engine
Typical ways of communication
Checkout
Payment
Order
Shipment Checkout
Payment
Order
Shipment
Checkout
PaymentOrder
Shipment
Message/Event Bus REST-ish
Pub/SubOwnership
Checkout
Payment
Order
Shipment
Workflow
Engine
Workflow
Engine
Monitoring
Checkout
Payment
Order
Shipment
Workflow
Engine
Monitoring
Checkout
Payment
Order
Shipment
Workflow
Engine
Workflow
Engine
Monitoring
How many workflow engines?
Monitoring
Checkout Inventory
Payment Shipment
Workflow
Engine
Order
Workflow
Engine
Monitor
e.g.
Elastic
Links back
Optimize
Example
https://github.com/berndruecker/flowing-retail/tree/master/kafka/java/monitor
What we currently build with some customers…
Camunda
Optimize
Elastic
17
Registration
requested
Credit
checked
Address
checked
Customer
registered
@berndruecker
Recap
• Microservices have its merits
• You need to balance orchestration and chorography
• Track, monitor or manage the flow – depending on your scenario
• Distributed systems need stateful orchestration
• Visibility is essential to survive
• Workflow automation is an essential building block,
make sure to use BPMN
Thank you!

Camunda Day Amsterdam 2019: Workflow Automation in Microservices Architectures by Niall Deehan

Editor's Notes

  • #12 Do you remeber that one release a quarter done in insurance industries? Abstimmung für Deployments / Changes JIRA Issues to create database / offshored
  • #14 https://en.wikipedia.org/wiki/Les_Ballets_de_Monte_Carlo https://ro.wikipedia.org/wiki/Moshing https://en.wikipedia.org/wiki/The_Wedding_Dance https://www.flickr.com/photos/blancalala/7209249422
  • #15 https://pxhere.com/en/photo/1132895
  • #46 http://www.istockphoto.com/de/foto/wicked-wind-grand-haven-lighthouse-michigan-usa-gm135811641-18609389
  • #56 Engine != Model Ownership
  • #57 Engine != Model Ownership
  • #90 http://www.istockphoto.com/de/foto/wicked-wind-grand-haven-lighthouse-michigan-usa-gm135811641-18609389