@berndruecker
Live coding some
(microservice)
integration patterns
Photo by Tookapic, available under Creative Commons CC0 1.0 license.
„There was an error
while sending your
boarding pass“
Check-in
Web-UI
Me
Current situation
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Some
Service
Failure will happen.
Accept it!
But keep it local!
Be resilient.
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Current situation – the bad part
Stateful
Retry
We are having some technical
difficulties and cannot present you
your boarding pass right away.
But we do actively retry ourselves, so
lean back, relax and we will send it
on time.
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Possible situation – much better!
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Possible situation – much better!
Stateful
Retry
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
Stateful
Retry
Possible situation – much better!
The failure
never leaves
this scope!
Resulting challenges
Persistent state Asynchronous
communication
We will talk about why this is
a good thing in a minute!
Solve technical challenges
(operating, scheduling,
versioning, visibility,
scalability, …) without
accidential complexity
Change the user experience
Warning:
Contains Opinion
bernd.ruecker@camunda.com
@berndruecker
http://berndruecker.io/
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
Check-In
A workflow engine is a durable state machine
Barcode
REST
Stateful
retry
„The customer wants a synchronous response“
Check-in
Barcode
Generator
Web-UI
Me
Output
Mgmt
„Eh – no!“
Simple example for live coding
Credit
Card
Payment
REST
Live hacking
https://github.com/berndruecker/flowing-retail
Payment
Now you have a state machine!
Credit
Card
REST
Do you have to program
all integration
logic?
26
@berndruecker
Connectors Modeling
Experience
Low-code
Forms
Human Task
Orchestration
CAMUNDA
Low-code Pro-code
Process Orchestration
Kopfhörer
@berndruecker
@OutboundConnector(
type = "io.camunda:http-json:1", inputVariables = {"method", ...},
)
public class HttpJsonFunction implements OutboundConnectorFunction {
public Object execute(final OutboundConnectorContext context) throws Exception {
final var json =;
final var request = createRequest(context);
return httpService.executeConnectorRequest(request);
}
} {
"name": "REST Connector",
"properties": [
{
"type": "Hidden",
"value": "io.camunda:http-json:1",
"binding": {
"type": "zeebe:taskDefinition:type"
}
},
{
"id": "method",
"label": "REST Method",
"group": "endpoint",
"type": "Dropdown",
"value": "get",
"choices": [
https://github.com/camunda/connectors-bundle/tree/main/connectors/http-json
@berndruecker
Runs anywhere
Multiple connector runtime options,
including SaaS, self-managed, co-
located, and local installations
@berndruecker
Criticality,
value,
complexity…
Use Cases
@berndruecker
or
enable
@berndruecker
Criticality,
value,
complexity…
Use Cases
@berndruecker
Payment
But back to integration logic…
Credit
Card
REST
has to implement
Retry
has to implement
Idempotency
Client Service Provider
Make every service idempotent!
Credit
Card
Payment
Charge Credit Card
cardNumber
amount
Charge Credit Card
cardNumber
amount
transactionId
Not idempotent
Idempotent
charge
Don‘t worry, it will happen safely –
even if you loose connection.
Feel free to reload this page any time!
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Distributed
systems
It is impossible to
differentiate certain
failure scenarios.
Independant of
communication style!
Service
Provider
Client
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Distributed systems introduce complexity you have to tackle!
Credit
Card
Payment
REST
Cancel
charge
retrievePayment
HTTP 200 OK
HTTP 202 ACCEPTED
Payment
Happy case: Synchronous response
Otherwise: asynchronous
Embrace asynchronicity
Live hacking
https://github.com/berndruecker/flowing-retail/blob/master/rest/java/payment/
src/main/java/io/flowing/retail/payment/rest/PaymentRestHacksControllerV4.java
Long running capabilities
are essential to design
good service boundaries
(= a good architecture)
@berndruecker
Example
Order
Fulfillment
Payment
Retrieve
Payment
@berndruecker
Example
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
@berndruecker
Example
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
Rejected
@berndruecker
Example
Order
Fulfillment
Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
Example
Order
Fulfillment
Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
A few
smart god services
tell
anemic CRUD services
what to do
Sam Newmann
Payment
failed
Who is responsible to deal with problems?
Order
Fulfillment
Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
Payment
failed
(Potentially) long running services
Order
Fulfillment
Payment
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
Long running capabilities
are essential to design
good service boundaries
(= a good architecture)
@berndruecker
You need to redesign
your customer journeys
to leverage your
hipster architecture!
Shutterstock
Did you just say “hipster”?
Let‘s talk about messaging.
Who uses a message bus?
Who has no problems
operating a message bus?
Dead messages | No context | Inaccesible payload | Hard to redeliver |
Home-grown message hospitals | …
Using messaging
Credit
Card
Request
Dead letter queue
(DLQ)
Using messaging
Credit
Card
Request
Dead letter queue
(DLQ)
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
Manigfold architecture options
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
Did you just say “hipster”?
Order
Placed
Payment
Received
Goods
Shipped
Notification
Event-driven & Reactive
@berndruecker
Checkout
Payment
Inventory
Shipment
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Phil Calcado at QCon NYC 2019
Notification
Checkout
Payment
Inventory
Shipment
@berndruecker
Pinball Machine Architecture
„What the hell just happened?“
@berndruecker
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and Pedobear19 / CC BY-SA 4.0
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
Extract Orchestration logic
Orchestration logic live inside service boundaries
Event-driven example
Inventory
Payment
Order Shipping
Checkout Monitor
https://github.com/berndruecker/flowing-retail/
Human
Tasks
H2 H2
Code
https://github.com/berndruecker/flowing-retail
Summary
Thank you!

JCon Live 2023 - Lice coding some integration problems