Reactive application development gives us better ways to build scalable applications, but often together with a micro-services jigsaw puzzle. Decoupled teams can rapidly deliver decoupled services, but you still need to piece together an end-to-end system. This presentation introduces an alternative way to think about and architect reactive applications using workflow tools.
Modern workflow management tools enable a convenient process-oriented approach to service orchestration that is itself reactive. More importantly, process management technology provides two key features that hand-coded applications typically lack: persistent execution state and an editable graphical process representation that you can use to define and adjust service orchestration. After learning how to coordinate micro-services, you will also and how to use the same system to orchestrate micro-service-like human workers. It turns out that with the right platform, human actors can also be reactive services, and participate in the same architecture.
4. 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
6. 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 •
9. 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 •
10. 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 •
11. // 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)
}
13. 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 •
18. Microservice orchestration
You need to coordinate microservices calls,
at the application level,
figure out where the data goes, and
where errors happen
18@PeterHilton •
19. 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
24. 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 •
25. 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.
26. Persistent execution state
Workflow makes execution state persistent
(like continuations)
This makes the whole system more resilient
26@PeterHilton •
28. 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 •
29. 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 •
30. Does it scale?
It won’t run Netflix
but could handle orders for the televisions
Maersk Line / CC BY-SA 2.0
31. 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 •
34. µ-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 •
36. 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 •
37. 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 •
42. 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 •
44. 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 •