@PeterHilton
http://hilton.org.uk/
Process-oriented reactive
service architecture
Using workflow tools to orchestrate
microservices and human workers
Outline
Reactive programming
Microservices
Workflow automation
Orchestrating µservices with workflows
Microservices vs human workers
2@PeterHilton •
Reactive programming
jaymarable / CC BY 2.0
Order processing example

1. Receive order from customer
2. Validate order

(Notify customer if order is not valid)
3. Fulfil order and ship from warehouse
4. Send delivery estimate to customer
5. Update inventory management system
6. Mark order as complete
⚙
⚙
⚙ ⚙
Asynchronous

parallel execution
Process
order
Update
inventory
Ship order
Estimate
delivery
Reactive programming
Reactive programming focuses on building
decoupled scalable and resilient services.
Reactive APIs make it easy to call other
services asynchronously and in parallel,
especially in a microservice architecture.
6@PeterHilton •
Parallel book publication
Reactive Manifesto
‘A reactive system must react to:
1. its users (responsive)
2. failure and stay available (resilient)
3. variable load conditions (elastic)
4. inputs (message-driven)’
9@PeterHilton •
Parallel execution
Reduces latency to the maximum latency of a
set of tasks instead of the sum of latencies
Uses non-blocking Future-based APIs,
available in more languages than you’d
expect*
* including Visual Basic 10@PeterHilton •
// Start parallel task execution:
val inventory: Future[Inventory] = updateStock()
val shipment: Future[Shipment] = shipOrder()
val delivery: Future[Delivery] = planDelivery()
// Complete task execution:
val completedOrder: Future[Result] =
for (i ← inventory;
s ← shipment;
d ← delivery) {
yield aggregate(i, s, d)
}
Future[Delivery]
Delivery
task complete3.
🕓
planDelivery()1.
Future[Delivery]
task created2.
Asynchronous execution
Non-blocking calls
Threads don’t block on async execution
Few threads handle many executions
Task-oriented orchestration
Task completion code is separate from task
creation
13@PeterHilton •
Microservices & the
orchestration problem
Microservices (µservices)
15@PeterHilton •
Network-based service decomposition.
Modularisation at deployment unit level
Reactive code to coordinate µservice calls.
Responsive design mitigates network latency
* µ = U+00B5 MICRO SIGN, Option-M (macOS)
⚙ ⚙ ⚙
⚙ ⚙
Service orchestration
Validate
order
Notify
customer
Update
inventory
Estimate
delivery
Ship order
⚙
Process
order
⚙ ⚙ ⚙
Validate
order
Update
inventory
Ship order
Centralised orchestration
Microservice orchestration
You need to coordinate microservices calls, 

at the application level,
figure out where the data goes, and
where errors happen
18@PeterHilton •
The orchestration problem
19@PeterHilton •
Code that coordinates microservices calls:
lacks flexibility, and
always gets messy.
You end up with callback hell, or more
advanced solutions like:
Reactive Extensions - Rx.NET/Rx.java/RxJS, or
complex functional types
Orchestrating service
calls using workflow
⚙
⚙
⚙ ⚙
Order processing
example
Process
order
Update
inventory
Ship order
Estimate
delivery
Business process 

model
parallel
fork
exclusive

fork
Business process 

model
parallel forkexclusive fork
(conditional)
Workflow systems and automation
Workflow management is 

process-centric programming.
Workflow management systems provide
a platform for process execution.
Automation involves integration with
external systems.
24@PeterHilton •
Workflow for service orchestration
25@PeterHilton •
Workflow systems give developers a way to
orchestrate service calls.
Workflow automation offers two key benefits
over conventional application code:
1. persistent execution state
2. graphical process representation.
Persistent execution state
Workflow makes execution state persistent
(like continuations)
This makes the whole system more resilient
26@PeterHilton •
Graphical representation
Graphical representation
Workflow gives you an editable graphical
representation of the orchestration
This process model that makes it easy to see
and change how the web services interact.
28@PeterHilton •
Modern workflow platforms
Traditional workflow systems are based on
fixed processes that integrate with monolithic
enterprise IT systems.
Modern workflow tools support iterative
process development and lightweight
integration using JavaScript, JSON and HTTP.
29@PeterHilton •
Does it scale?
It won’t run Netflix
but could handle orders for the televisions
Maersk Line / CC BY-SA 2.0
Workflow execution is reactive
Immediate response to workflow state queries
(responsive, elastic)
Execution failures are isolated
(resilient)
Persistent execution state
(resilient)
Execution is triggered by events
(message-driven) 31@PeterHilton •
Workflow & the missing
ingredient for µservices
Microservice calls
µ-service coordination using workflow
Process steps are Service Tasks that call
µservices.
The process model orchestrates execution and
persistent data.
The execution platform manages versioning,
deployment, multiple executions, reporting…
This is another way of programming µservices
34@PeterHilton •
Franklin Heijnen / CC BY-SA 2.0
Human tasks
Human workers as µ-services
Process steps can also be Human Tasks, such
as filling in a form, assigned to a person.
In a workflow system, a human task has the
same API as µservice call.
By adding Human Tasks to process models,
you can program human actors.
36@PeterHilton •
Human task coordination using workflow
Some process models only contain Human
Tasks.
With human processes, workflow systems
become collaboration platforms.
Process management == people management
37@PeterHilton •
Strict order rejection
39@PeterHilton •
Alan Clark / CC BY-ND 2.0
call centre human
Manual correction
Alan Clark / CC BY-ND 2.0
task escalation
Disadvantages
Development and testing
Workflow management systems have limited
automated testing capabilities (for now)
Vendor-specific process description
Process models are only partly standardised
Graphical models don’t integrate with
traditional developer tools 42@PeterHilton •
Conclusion
Conclusion
Workflow automation tools provide a
convenient solution for µservice orchestration
Workflow engines are reactive, reactive
programming is cool, so workflow is cool
Workflow automation includes human tasks,
so you can also program the humans!
You don’t necessarily want to really do this :)
44@PeterHilton •
@PeterHilton
http://hilton.org.uk/

Process-oriented reactive service architecture