Combining
Orchestration and
Choreography for a
Clean Architecture
Thomas Heinrichs
Thomas Heinrichs
BPM Consultant
Augsburg, Germany
About
12
Team Members
8
Projects
2020
Founded
Training
BPMN, DMN &
Architecture Training
Consulting
Flexible remote
consulting
Workshops
Proof of concepts &
Quickchecks
Professional Services
Custom development
projects
What to expect
Reviewing the low code
approach
How does a low code implementation
look like?
What are advantages and downsides?
Writing clean
integrations
What is clean architecture?
How to implement a hexagonal
architecute?
How to write engine independent code?
Scaling up
What is Domain Driven Design?
What is Choreography?
What are the best practices for
domain events?
Let’s talk
about Pizza!
… and low-code
Our digital
Restaurant
Reviewing the low code approach
ADVANTAGES
• Rest Connectors enable non-technical
users to create and modify automated
processes
• Calling external services with the
low code approach reduces
development time and costs
• Lowers the barrier to entry for
process automation
DISADVANTAGES
• Tighter coupling and violation of
the separation of concerns principle
due to Connectors
• Can easier lead to a vendor-lock-in
problem
• Need for a greater dataset flow
through the process instance
• Misuse of the BPMN standard
Relying on Connectors
- it depends on the use case
DO IT YOURSELF
• Simple
• Local automations
with little
criticality
• No governance or
quality assurance
needed
GUIDED
• Medium complexity
• Medium cirticality
• Some governance
required
• Some guidance
necessary
PROFESSIONAL
DEVELOPMENT
• High complexity
• High criticality
• Complicance and
regulatory
requirements
• Version control
• Automated testing
Use domain specific
Connectors
Sending an SMS Example
Protocol level Domain level
Writing clean integrations
ā€œAt its core, clean architecture divides a software
system into parts, with each part having a specific
responsibility and clear dependencies.ā€
Definition: Clean Architecture
Benefits: Increased Maintainability, Testability, Scalability, Flexibility, Collaboration
Writing Hexagonal
Integrations
Ports and Adapters
• We organize the hexagonal architecture into
layers
• The outermost consist of adapters that translate
between the application and other systems
No outgoing dependencies
• All dependencies point toward the center
• The Domain has no dependency towards the Use-Case
or an Adapter
Benefits
• Truly technology neutral application core
• Easily adaptable to new technical surroundings
• Far easier maintainable
Integration Component
Using Hexagonal Architecture
Clean Architecture Diagram
Updated
Process
Clean Architecture Diagram
Demo –
Implementation of a
hexagonal
architecture
Scaling up
With a clever mix of a choreographed event-based
style and an orchestrated command based style you
can reach the level of decoupling you aim for!
What is Choreography?
Uses event-driven
communication
Event = Something happended in
the past. It is a fact. Sender
does not know who picks up the
event.
Pizza
Place
You
ā€žHey – I am hungry!ā€œ
Applying Domain Driven Design
ā€œDomain Driven Design is an approach to software
development that centres on programming a domain
model that has a rich understanding of the
processes and rules of a domain.ā€
Martin Fowler
Bounded Context
DDD devides up a large
system into Bounded
Contexts, which can have
a unified model
Bounded Contexts have
both, unrelated concepts
but also some shared ones
Acts as a central
patterns and allows to
create dependencies based
on the domain logic
Evolving our architecture
Demo –
Choreography
combined with
Orchestration
Throwing the right domain events
- Best Practices
Use clean names and
do not reuse events
Throw events when you
manipulate data (e.g.
create, update, delete)
Do not expect something
in return after having
thrown the event
Try to use it only for
communication out of
the bounded context
Key Takeaways
Design your services technology and engine neutral
Use Domain Events for communication outside the bounded context
Gain better maintainability by using a hexagonal architecture
For an ideal decoupled architecture use a clever mix of a choreographed
event-based style and an orchestrated command based style communication
Thanks for listening!
Thomas Heinrichs
BPM Consultant

Combining Orchestration and Choreography for a Clean Architecture

  • 1.
    Combining Orchestration and Choreography fora Clean Architecture Thomas Heinrichs
  • 2.
  • 3.
    About 12 Team Members 8 Projects 2020 Founded Training BPMN, DMN& Architecture Training Consulting Flexible remote consulting Workshops Proof of concepts & Quickchecks Professional Services Custom development projects
  • 4.
    What to expect Reviewingthe low code approach How does a low code implementation look like? What are advantages and downsides? Writing clean integrations What is clean architecture? How to implement a hexagonal architecute? How to write engine independent code? Scaling up What is Domain Driven Design? What is Choreography? What are the best practices for domain events?
  • 5.
  • 6.
  • 7.
    Reviewing the lowcode approach ADVANTAGES • Rest Connectors enable non-technical users to create and modify automated processes • Calling external services with the low code approach reduces development time and costs • Lowers the barrier to entry for process automation DISADVANTAGES • Tighter coupling and violation of the separation of concerns principle due to Connectors • Can easier lead to a vendor-lock-in problem • Need for a greater dataset flow through the process instance • Misuse of the BPMN standard
  • 8.
    Relying on Connectors -it depends on the use case DO IT YOURSELF • Simple • Local automations with little criticality • No governance or quality assurance needed GUIDED • Medium complexity • Medium cirticality • Some governance required • Some guidance necessary PROFESSIONAL DEVELOPMENT • High complexity • High criticality • Complicance and regulatory requirements • Version control • Automated testing
  • 9.
    Use domain specific Connectors Sendingan SMS Example Protocol level Domain level
  • 10.
    Writing clean integrations ā€œAtits core, clean architecture divides a software system into parts, with each part having a specific responsibility and clear dependencies.ā€ Definition: Clean Architecture Benefits: Increased Maintainability, Testability, Scalability, Flexibility, Collaboration
  • 11.
    Writing Hexagonal Integrations Ports andAdapters • We organize the hexagonal architecture into layers • The outermost consist of adapters that translate between the application and other systems No outgoing dependencies • All dependencies point toward the center • The Domain has no dependency towards the Use-Case or an Adapter Benefits • Truly technology neutral application core • Easily adaptable to new technical surroundings • Far easier maintainable Integration Component Using Hexagonal Architecture
  • 12.
  • 13.
  • 14.
  • 15.
    Demo – Implementation ofa hexagonal architecture
  • 16.
    Scaling up With aclever mix of a choreographed event-based style and an orchestrated command based style you can reach the level of decoupling you aim for!
  • 17.
    What is Choreography? Usesevent-driven communication Event = Something happended in the past. It is a fact. Sender does not know who picks up the event. Pizza Place You ā€žHey – I am hungry!ā€œ
  • 18.
    Applying Domain DrivenDesign ā€œDomain Driven Design is an approach to software development that centres on programming a domain model that has a rich understanding of the processes and rules of a domain.ā€ Martin Fowler
  • 19.
    Bounded Context DDD devidesup a large system into Bounded Contexts, which can have a unified model Bounded Contexts have both, unrelated concepts but also some shared ones Acts as a central patterns and allows to create dependencies based on the domain logic
  • 20.
  • 21.
  • 22.
    Throwing the rightdomain events - Best Practices Use clean names and do not reuse events Throw events when you manipulate data (e.g. create, update, delete) Do not expect something in return after having thrown the event Try to use it only for communication out of the bounded context
  • 23.
    Key Takeaways Design yourservices technology and engine neutral Use Domain Events for communication outside the bounded context Gain better maintainability by using a hexagonal architecture For an ideal decoupled architecture use a clever mix of a choreographed event-based style and an orchestrated command based style communication
  • 24.
    Thanks for listening! ThomasHeinrichs BPM Consultant

Editor's Notes

  • #22Ā Show service which throws a Domain Event Mention that there is the Kafka Out Adapter which published the actual event We are having a separate satisfaction miranum service Consumes event Starts a process via a message Run through example Frontend start take-away Open Operate show instance moving through process Show created task in TaskList