SlideShare a Scribd company logo
1 of 56
Download to read offline
ASYNC MESSAGING in CQRS
PART 2: AKKA.NET
DDD GREECE
dotNETZone.gr
Athens .NET
AKKA.NET
AKKA.NET
ACTOR MODEL
▸ model for building systems that are
▸ distributed
▸ concurrent
▸ fault tolerant
▸ old concept (70’s) revisited
▸ Erlang/Elixir built-in support
AKKA.NET
ACTOR
▸ fundamental abstraction
▸ analogy to the “object” in OO
▸ lifecycle
▸ state & behaviour
▸ live in a tree-like hierarchy
▸ created by its parent
▸ creates its children
AKKA.NET
ACTOR HIERARCHY 1/2
AKKA.NET
ACTOR HIERARCHY 2/2
▸ actors have names
▸ hierarchy is an addressing model
▸ used to REFER to actors via path expressions:
▸ relative: ../z
▸ absolute: /A/w
▸ selective: /B/y/*
AKKA.NET
TALKING TO ACTORS 1/3
3
//
2.
2.
2. / 2
2.
2. 1
AKKA.NET
TALKING TO ACTORS 2/3
▸ tell: fire-and-forget—like message sending
▸ ask: request/response-like message sending
▸ message delivery: Αt-Μost-Οnce
WAIT … WHAT ?
AKKA.NET
ASYNC & RELIABLE MESSAGING (AGAIN)
ALL=CA .KI AK
N ELDAK A AK AM
N L KE AK ( A AE AK
AM
N L KE AK )
1P D= CA -
NANA ( NANA )
1P D= CA . R
)
-/3IK1KKIK
(
A
-/3IK
=
LC A E AKQ EL 142-.41 ( # , 2B
LC EL IM - A Q MDA .KI AK =
1KKIK EL K=ELA E MDA A AK
LC A E AKQ EL 142-.41 ) # , 2B LC EL IM - A IK
= A Q MDA A AE AK MDA LC LM=QL E MDA NANA
LC A E AKQ A MI
A # EL - / ,
A AK EL I A =BMAK
CAMME C MDA -
LC A E AKQ EL
142-.41 # ,
NANAL = A
AKLELMA M = KILL
KI AK KALM=KML
- = EM # 1 - 41
AAEA
AKKA.NET
RELIABLY DELIVERY IN AKKA .NET
▸ abstractions provided (AtLeastOnceDeliveryReceiveActor) but:
▸ sending actor needs to:
▸ persist/recover (i.e. retry) outgoing messages
▸ handle confirmations
▸ receive actor needs to:
▸ send confirmations
▸ encapsulate in a reusable library
AKKA.NET
(BACK TO) TALKING TO ACTORS 3/3
▸ behaviour + state transitions happen only via messaging
▸ actors do NOT:
▸ share state
▸ refer to each other in any other way
▸ e.g. CLR refs
AKKA.NET
COMMAND SENDING
▸ ActorSystem is single instance per process
▸ Context when inside Actor context
▸ references can be acquired using path expressions
AKKA.NET
COMMAND HANLDING
AKKA.NET
CONCURRENT ACTORS
▸ actors have a FIFO mailbox
▸ actor work is serialised
▸ no Threads, TPL etc.
AKKA.NET
SUPERVISING ACTORS 1/3
▸ hierarchy is also a supervision model
▸ directives:
▸ catch child(ren) exception(s) and ..
▸ resume or
▸ restart or
▸ escalate to parent or
▸ stop the faulty child(ren)
AKKA.NET
SUPERVISING ACTORS 2/3
▸ strategies
▸ one-for-one
▸ apply to the faulty child only
▸ all-for-one
▸ apply to all children
AKKA.NET
SUPERVISING ACTORS 3/3
AKKA.NET
HOSTING ACTORS
3 / 31432/2 443 / 31432/2 44
3 / 31432/2 44
3 / 31432/2 44
# / 44
3 #
3 #
3 4 /2
3 # #
3 /2./
TYPICALLY LONG-
LIVING/ROUTING
ACTORS
TYPICALLY ERROR
PRONE/SHORT LIVING
ACTORS
TYPICALLY PROCESS
MANAGERS
AKKA.NET
LOCATION TRANSPARENCY
‣ refer to an actor with relative paths (e.g. “/X/y”) from any
host
‣ actual actor host is known by the runtime
AKKA.NET

vs
MASSTRANSIT
AKKA.NET VS MASSTRANSIT
ABSTRACTIONS
▸ Consumer
▸ = message handler
▸ Saga
▸ = process manager
▸ No routing abstraction
▸ Actor can be
▸ routers
▸ message handlers
▸ process managers
▸ supervisors
MASSTRANSIT AKKA.NET
AKKA.NET VS MASSTRANSIT
LIFECYLE
▸ Consumers/Sagas are:
▸ (re-)instantiated upon
message dequeuing by
the runtime
▸ disposed after message
handling
▸ Actors are:
▸ instantiated and
disposed by parent
actors
▸ message handling
decoupled from actor
lifecycle
MASSTRANSIT AKKA.NET
AKKA.NET VS MASSTRANSIT
MESSAGING PATTERNS
▸ At-Most-Once
▸ No Built-in At-Least-
Once support
▸ Tell, Ask
▸ No Built-In Pub/Sub
support
▸ At-Least-Once
▸ Send, Request/Response,
Pub/Sub
AKKA.NETMASSTRANSIT
AKKA.NET VS MASSTRANSIT
ROUTING
▸ Routing non-leaf level actors.
▸ Pools: create the actors
(routees) messages will be
routed to
▸ Groups: get routees by ref
▸ RoundRobin(Group),
BroadCast(Group),
ConsistentHashing(Group),

OurOwn(Group)
▸ Routing topology auto-
created
▸ Customise only via the
transport API
▸ Message name(space)-
based routing
AKKA.NETMASSTRANSIT
AKKA.NET VS MASSTRANSIT
ERROR HANDLING
▸ coordinated▸ per handler
AKKA.NETMASSTRANSIT
AKKA.NET VS MASSTRANSIT
IN-PROCESS PARALLELISM & CONCURRENCY
▸ Named Actor + Mailbox =
Concurrency Checks
“Avoidance”
▸ Re-use as-is in-process
▸ Threadpool
▸ Basic Parallelism
▸ Concurrency very Hard
▸ “Concurrency”Limit:
▸ = pool size
▸ No in-process support
▸ use TPL
AKKA.NETMASSTRANSIT
AKKA.NET
TYPICAL SYSTEM with CQRS + ASYNC PROCESSING
/ *
-BBB
3
B BB #
/ A A *
3 BB # 3 A
A BC A B A C A C B BC C
B 2 3
AB BCB BC C CB
B B A B B CB
C
B BB #
B 3B C 2 3 A B C A 3 3
. 3 - 3
C
2 B BC C#
/ A A * (
3 A A
A 2 BB C
3 AB#
C A 2 BB# C
B B2A A#
/ A A * )
2 ACB CB
C A 3 3
2CB 3 AB BCB
/A C 3
AKKA.NET
FROM MASSTRANSIT TO AKKA.NET
▸ worker app serves as router for out-of-process event pub/sub
▸ command issuing apps:
▸ ref non-leaf level actors routing/life-cycle mgmt actors
▸ live in worker apps
▸ worker apps
▸ create actor hierarchy used for command and event
handling
AKKA.NET VS MASSTRANSIT
INDICATIONS FOR AKKA.NET 1/3
▸ many aggregates and very often rehydrations
▸ “hot” aggregate instances via actor lifecycle control
▸ selective disposal via actor selection and supervision
▸ massively parallel but ordered command/event handling
▸ avoid concurrency check with named actors + one
mailbox per actor
AKKA.NET VS MASSTRANSIT
INDICATIONS FOR AKKA.NET 2/3
▸ resource usage pattern vary significantly
▸ load-balanced routing
▸ infrastructure locality is important
▸ content-based routing
▸ coordination on infra error handling necessary
▸ policy-based supervision
AKKA.NET VS MASSTRANSIT
INDICATIONS FOR AKKA.NET 3/3
▸ transport infra (RabbitMQ, AzureServiceBus, etc.)
infeasible
▸ own transport
▸ stressed transport broker(ing) adds latency
▸ own transport is p2p
RESILIENCE
RESILIENCY IS THE ABILITY TO WITHSTAND
CERTAIN TYPES OF FAILURE AND YET REMAIN
FUNCTIONAL FROM THE CUSTOMER
PERSPECTIVE
David Bills - Microsoft
RESILIENCE
RESILIENCE
CUSTOMER BILLING: REQUIREMENTS
CUSTOMER BILLING PROCESS v1
▸ on cargo delivery to destination location
1. collect payment
2. if payment succeeds
A. issue an invoice
B. notify the customer for payment success + attach invoice
3. otherwise notify the customer for payment failure
RESILIENCE
CUSTOMER BILLING: INVARIANT
▸ Payment.Success



AND
▸ InvoiceNumber != No.Invoice
RESILIENCE
WARNING
ASYNC MESSAGING 

!= 

ASYNC/AWAIT
RESILIENCE
ATTEMPT 1 - SYNC HANDLING OF DELIVERYSTATECHANGED
RESILIENCE
ATTEMPT 2 - ASYNC + RETRY
RESILIENCE
ATTEMPT 3 - ASYNC + RETRY + IDEMPOTENT 1/3
IDEMPOTENT PAYMENT COLLECTING
RESILIENCE
ATTEMPT 3 - ASYNC + RETRY + IDEMPOTENT 2/3
RESILIENCE
ATTEMPT 4 - ASYNC + RETRY + IDEMPOTENT + PROCESS DATA
RESILIENCE
ATTEMPT 4 - DISCUSSION 1/2
▸ need to persistently maintain process data:
▸ current process state
▸ Payment Executed, Issue Invoiced etc ..
▸ output of current action
▸ = input of next action
RESILIENCE
ATTEMPT 4 - DISCUSSION 2/2
Action
When
State
New State
Data
Needed
Next
Action
Execute
Payment
None
Payment

Executed
DeliveryState

Changed
Issue

Invoice
Issue
Invoice
Payment

Executed
Invoice

Issued
PaymentResult.
Success &
TransactionId
Notify
Customer
Notify
Customer
Invoice

Issued
Customer

Notified
Invoice.Link
Update
Domain
Update
Domain
Customer

Notified
Completed
PaymentResult.
Success &
TransactionId,
Invoice.Number
N/A
RESILIENCE
IDEA
▸ one handler per action
▸ sets the current state
▸ sends a command (to the next handler)
▸ incl. action output (needed for next action)
STILL RESILIENT ?
RESILIENCE
ATTEMPT 5 - ONE HANDLER PER ACTION
RESILIENCE
ATTEMPT 5 - DISCUSSION
▸ handlers need to know the process context
▸ to set the current state
▸ to “invoke” the next action
▸ “UpdateDomain” Command ???
INCREASED
COUPLING
RESILIENCE
IDEA
▸ “action” handlers … handle only commands
▸ and emit events
▸ a “manager” handler
▸ issues the commands to the “action” handlers
▸ handles emitted events and …
▸ sets process state
▸ update the domain at the end
“PROCESS MANAGER”
RESILIENCE
ATTEMPT 6 - PROCESS MANAGER
BC A
A
BC A
E A C C
E C
C DBC A
A
BBD E
BBD E
A
C DBC A
A BB C
A BB C
A
C A BB
E C
E BBD
E C
DBC A C
E C
RESILIENCE
PROCESS MANAGER in AKKA.NET
BE FAIR: MASSTRANSIT SUPPORTS
PROCESS MANAGERS (SAGAS)
RESOURCES
RESOURCES
OTHER ACTOR-BASED FRAMEWORKS in .NET
▸ Orleans https://dotnet.github.io/orleans/
▸ Virtual Actor: Cleaner syntax and semantics
▸ Less Control in Lifecycle, Supervision and Topology
▸ Proto.Actor http://proto.actor/
▸ Closer to Orleans (Virtual Actors) but more on Supervision
▸ Lightweight and very Performant
▸ .NET Core, Go, Java and Kotlin

RESOURCES
LEARNING 1/2
▸ Reactive Applications with AkkaNET

https://www.manning.com/books/reactive-applications-with-akka-net

Anthony Brown
▸ To be published in November (?) 2017
▸ Reactive Messaging Patterns with the Actor Model: Applications and
Integration http://a.co/70rOL4C

Vaughn Vernon
▸ Scala/Java Akka
▸ Focus on messaging/EAI

RESOURCES
LEARNING 2/2
▸ Pluralsight / Building Concurrent Applications with the
Actor Model in Akka.NET 

https://goo.gl/KXsbYn 

Jason Roberts
▸ 8 courses in total
▸ Akka.NET Bootcamp 

https://github.com/petabridge/akka-bootcamp

Petabridge
▸ Free
RESOURCES
READINGS
▸ The Actor Model in 10 Minutes

http://www.brianstorti.com/the-actor-model/

Brian Storti
▸ Refactoring Towards Resilience Series

https://jimmybogard.com/refactoring-towards-resilience-a-primer/ 

Jimmy Bogard
Q&A

More Related Content

What's hot

Docker Introduction
Docker IntroductionDocker Introduction
Docker IntroductionHao Fan
 
PowerDNS with MySQL
PowerDNS with MySQLPowerDNS with MySQL
PowerDNS with MySQLI Goo Lee
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Steve Pember
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusClaus Ibsen
 
Introduction to Gremlin
Introduction to GremlinIntroduction to Gremlin
Introduction to GremlinMax De Marzi
 
Canary Releases on Kubernetes w/ Spinnaker, Istio, and Prometheus
Canary Releases on Kubernetes w/ Spinnaker, Istio, and PrometheusCanary Releases on Kubernetes w/ Spinnaker, Istio, and Prometheus
Canary Releases on Kubernetes w/ Spinnaker, Istio, and PrometheusKublr
 
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다Arawn Park
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker, Inc.
 
빠르게훓어보는 Node.js와 Vert.x
빠르게훓어보는 Node.js와 Vert.x빠르게훓어보는 Node.js와 Vert.x
빠르게훓어보는 Node.js와 Vert.xTerry Cho
 
Distributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastDistributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastMesut Celik
 
Zero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesZero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesWojciech Barczyński
 
Traffic Control with Envoy Proxy
Traffic Control with Envoy ProxyTraffic Control with Envoy Proxy
Traffic Control with Envoy ProxyMark McBride
 
MicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshMicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshAkash Agrawal
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootMikalai Alimenkou
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewRené Cannaò
 
Open stack architecture overview-meetup-6-6_2013
Open stack architecture overview-meetup-6-6_2013Open stack architecture overview-meetup-6-6_2013
Open stack architecture overview-meetup-6-6_2013Mirantis
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRSSteve Pember
 

What's hot (20)

Docker Introduction
Docker IntroductionDocker Introduction
Docker Introduction
 
PowerDNS with MySQL
PowerDNS with MySQLPowerDNS with MySQL
PowerDNS with MySQL
 
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
 
Apache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel QuarkusApache Camel v3, Camel K and Camel Quarkus
Apache Camel v3, Camel K and Camel Quarkus
 
Introduction to Gremlin
Introduction to GremlinIntroduction to Gremlin
Introduction to Gremlin
 
Canary Releases on Kubernetes w/ Spinnaker, Istio, and Prometheus
Canary Releases on Kubernetes w/ Spinnaker, Istio, and PrometheusCanary Releases on Kubernetes w/ Spinnaker, Istio, and Prometheus
Canary Releases on Kubernetes w/ Spinnaker, Istio, and Prometheus
 
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
잘 키운 모노리스 하나 열 마이크로서비스 안 부럽다
 
Docker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker SlidesDocker Birthday #3 - Intro to Docker Slides
Docker Birthday #3 - Intro to Docker Slides
 
NestJS
NestJSNestJS
NestJS
 
빠르게훓어보는 Node.js와 Vert.x
빠르게훓어보는 Node.js와 Vert.x빠르게훓어보는 Node.js와 Vert.x
빠르게훓어보는 Node.js와 Vert.x
 
Distributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with HazelcastDistributed Caching in Kubernetes with Hazelcast
Distributed Caching in Kubernetes with Hazelcast
 
Docker & Kubernetes intro
Docker & Kubernetes introDocker & Kubernetes intro
Docker & Kubernetes intro
 
Zero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with KubernetesZero downtime deployment of micro-services with Kubernetes
Zero downtime deployment of micro-services with Kubernetes
 
Traffic Control with Envoy Proxy
Traffic Control with Envoy ProxyTraffic Control with Envoy Proxy
Traffic Control with Envoy Proxy
 
MicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMeshMicroServices with Containers, Kubernetes & ServiceMesh
MicroServices with Containers, Kubernetes & ServiceMesh
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 
Hexagonal architecture with Spring Boot
Hexagonal architecture with Spring BootHexagonal architecture with Spring Boot
Hexagonal architecture with Spring Boot
 
ProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management OverviewProxySQL High Avalability and Configuration Management Overview
ProxySQL High Avalability and Configuration Management Overview
 
Open stack architecture overview-meetup-6-6_2013
Open stack architecture overview-meetup-6-6_2013Open stack architecture overview-meetup-6-6_2013
Open stack architecture overview-meetup-6-6_2013
 
A year with event sourcing and CQRS
A year with event sourcing and CQRSA year with event sourcing and CQRS
A year with event sourcing and CQRS
 

Similar to Async Messaging in CQRS: Part 2 - Akka.NET

Designing a reactive data platform: Challenges, patterns, and anti-patterns
Designing a reactive data platform: Challenges, patterns, and anti-patterns Designing a reactive data platform: Challenges, patterns, and anti-patterns
Designing a reactive data platform: Challenges, patterns, and anti-patterns Alex Silva
 
Async Messaging in CQRS: Part 1 - Masstransit
 Async Messaging in CQRS: Part 1 - Masstransit Async Messaging in CQRS: Part 1 - Masstransit
Async Messaging in CQRS: Part 1 - MasstransitGeorge Tourkas
 
Java Microservices with Netflix OSS & Spring
Java Microservices with Netflix OSS & Spring Java Microservices with Netflix OSS & Spring
Java Microservices with Netflix OSS & Spring Conor Svensson
 
Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaJohan Andrén
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudConor Svensson
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akkanartamonov
 
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"Fwdays
 
Discussion of NGRX-Entity
Discussion of NGRX-EntityDiscussion of NGRX-Entity
Discussion of NGRX-EntityNate Kidwell
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudConor Svensson
 
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Running High Performance and Fault Tolerant Elasticsearch Clusters on DockerRunning High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Running High Performance and Fault Tolerant Elasticsearch Clusters on DockerSematext Group, Inc.
 
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...PROIDEA
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practiceDocker, Inc.
 
Loadbalancing In-depth study for scale @ 80K TPS
Loadbalancing In-depth study for scale @ 80K TPS Loadbalancing In-depth study for scale @ 80K TPS
Loadbalancing In-depth study for scale @ 80K TPS Shrey Agarwal
 
Full Stack Reactive In Practice
Full Stack Reactive In PracticeFull Stack Reactive In Practice
Full Stack Reactive In PracticeLightbend
 
Kafka Connect - debezium
Kafka Connect - debeziumKafka Connect - debezium
Kafka Connect - debeziumKasun Don
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac DawsonCODE BLUE
 
Confitura 2018 — Apache Beam — Promyk Nadziei Data Engineera
Confitura 2018 — Apache Beam — Promyk Nadziei Data EngineeraConfitura 2018 — Apache Beam — Promyk Nadziei Data Engineera
Confitura 2018 — Apache Beam — Promyk Nadziei Data EngineeraPiotr Wikiel
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with KubernetesDeivid Hahn Fração
 

Similar to Async Messaging in CQRS: Part 2 - Akka.NET (20)

Designing a reactive data platform: Challenges, patterns, and anti-patterns
Designing a reactive data platform: Challenges, patterns, and anti-patterns Designing a reactive data platform: Challenges, patterns, and anti-patterns
Designing a reactive data platform: Challenges, patterns, and anti-patterns
 
Async Messaging in CQRS: Part 1 - Masstransit
 Async Messaging in CQRS: Part 1 - Masstransit Async Messaging in CQRS: Part 1 - Masstransit
Async Messaging in CQRS: Part 1 - Masstransit
 
Java Microservices with Netflix OSS & Spring
Java Microservices with Netflix OSS & Spring Java Microservices with Netflix OSS & Spring
Java Microservices with Netflix OSS & Spring
 
Helm 3
Helm 3Helm 3
Helm 3
 
Buiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with AkkaBuiilding reactive distributed systems with Akka
Buiilding reactive distributed systems with Akka
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring Cloud
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
 
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
 
Discussion of NGRX-Entity
Discussion of NGRX-EntityDiscussion of NGRX-Entity
Discussion of NGRX-Entity
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring Cloud
 
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Running High Performance and Fault Tolerant Elasticsearch Clusters on DockerRunning High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
 
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
DevOpsDays Warsaw 2015: Running High Performance And Fault Tolerant Elasticse...
 
ecs-presentation
ecs-presentationecs-presentation
ecs-presentation
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Loadbalancing In-depth study for scale @ 80K TPS
Loadbalancing In-depth study for scale @ 80K TPS Loadbalancing In-depth study for scale @ 80K TPS
Loadbalancing In-depth study for scale @ 80K TPS
 
Full Stack Reactive In Practice
Full Stack Reactive In PracticeFull Stack Reactive In Practice
Full Stack Reactive In Practice
 
Kafka Connect - debezium
Kafka Connect - debeziumKafka Connect - debezium
Kafka Connect - debezium
 
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
[CB16] 80時間でWebを一周:クロムミウムオートメーションによるスケーラブルなフィンガープリント by Isaac Dawson
 
Confitura 2018 — Apache Beam — Promyk Nadziei Data Engineera
Confitura 2018 — Apache Beam — Promyk Nadziei Data EngineeraConfitura 2018 — Apache Beam — Promyk Nadziei Data Engineera
Confitura 2018 — Apache Beam — Promyk Nadziei Data Engineera
 
Scaling Microservices with Kubernetes
Scaling Microservices with KubernetesScaling Microservices with Kubernetes
Scaling Microservices with Kubernetes
 

Recently uploaded

Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 

Recently uploaded (20)

Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 

Async Messaging in CQRS: Part 2 - Akka.NET

  • 1. ASYNC MESSAGING in CQRS PART 2: AKKA.NET DDD GREECE dotNETZone.gr Athens .NET
  • 3. AKKA.NET ACTOR MODEL ▸ model for building systems that are ▸ distributed ▸ concurrent ▸ fault tolerant ▸ old concept (70’s) revisited ▸ Erlang/Elixir built-in support
  • 4. AKKA.NET ACTOR ▸ fundamental abstraction ▸ analogy to the “object” in OO ▸ lifecycle ▸ state & behaviour ▸ live in a tree-like hierarchy ▸ created by its parent ▸ creates its children
  • 6. AKKA.NET ACTOR HIERARCHY 2/2 ▸ actors have names ▸ hierarchy is an addressing model ▸ used to REFER to actors via path expressions: ▸ relative: ../z ▸ absolute: /A/w ▸ selective: /B/y/*
  • 7. AKKA.NET TALKING TO ACTORS 1/3 3 // 2. 2. 2. / 2 2. 2. 1
  • 8. AKKA.NET TALKING TO ACTORS 2/3 ▸ tell: fire-and-forget—like message sending ▸ ask: request/response-like message sending ▸ message delivery: Αt-Μost-Οnce WAIT … WHAT ?
  • 9. AKKA.NET ASYNC & RELIABLE MESSAGING (AGAIN) ALL=CA .KI AK N ELDAK A AK AM N L KE AK ( A AE AK AM N L KE AK ) 1P D= CA - NANA ( NANA ) 1P D= CA . R ) -/3IK1KKIK ( A -/3IK = LC A E AKQ EL 142-.41 ( # , 2B LC EL IM - A Q MDA .KI AK = 1KKIK EL K=ELA E MDA A AK LC A E AKQ EL 142-.41 ) # , 2B LC EL IM - A IK = A Q MDA A AE AK MDA LC LM=QL E MDA NANA LC A E AKQ A MI A # EL - / , A AK EL I A =BMAK CAMME C MDA - LC A E AKQ EL 142-.41 # , NANAL = A AKLELMA M = KILL KI AK KALM=KML - = EM # 1 - 41 AAEA
  • 10. AKKA.NET RELIABLY DELIVERY IN AKKA .NET ▸ abstractions provided (AtLeastOnceDeliveryReceiveActor) but: ▸ sending actor needs to: ▸ persist/recover (i.e. retry) outgoing messages ▸ handle confirmations ▸ receive actor needs to: ▸ send confirmations ▸ encapsulate in a reusable library
  • 11. AKKA.NET (BACK TO) TALKING TO ACTORS 3/3 ▸ behaviour + state transitions happen only via messaging ▸ actors do NOT: ▸ share state ▸ refer to each other in any other way ▸ e.g. CLR refs
  • 12. AKKA.NET COMMAND SENDING ▸ ActorSystem is single instance per process ▸ Context when inside Actor context ▸ references can be acquired using path expressions
  • 14. AKKA.NET CONCURRENT ACTORS ▸ actors have a FIFO mailbox ▸ actor work is serialised ▸ no Threads, TPL etc.
  • 15. AKKA.NET SUPERVISING ACTORS 1/3 ▸ hierarchy is also a supervision model ▸ directives: ▸ catch child(ren) exception(s) and .. ▸ resume or ▸ restart or ▸ escalate to parent or ▸ stop the faulty child(ren)
  • 16. AKKA.NET SUPERVISING ACTORS 2/3 ▸ strategies ▸ one-for-one ▸ apply to the faulty child only ▸ all-for-one ▸ apply to all children
  • 18. AKKA.NET HOSTING ACTORS 3 / 31432/2 443 / 31432/2 44 3 / 31432/2 44 3 / 31432/2 44 # / 44 3 # 3 # 3 4 /2 3 # # 3 /2./ TYPICALLY LONG- LIVING/ROUTING ACTORS TYPICALLY ERROR PRONE/SHORT LIVING ACTORS TYPICALLY PROCESS MANAGERS
  • 19. AKKA.NET LOCATION TRANSPARENCY ‣ refer to an actor with relative paths (e.g. “/X/y”) from any host ‣ actual actor host is known by the runtime
  • 21. AKKA.NET VS MASSTRANSIT ABSTRACTIONS ▸ Consumer ▸ = message handler ▸ Saga ▸ = process manager ▸ No routing abstraction ▸ Actor can be ▸ routers ▸ message handlers ▸ process managers ▸ supervisors MASSTRANSIT AKKA.NET
  • 22. AKKA.NET VS MASSTRANSIT LIFECYLE ▸ Consumers/Sagas are: ▸ (re-)instantiated upon message dequeuing by the runtime ▸ disposed after message handling ▸ Actors are: ▸ instantiated and disposed by parent actors ▸ message handling decoupled from actor lifecycle MASSTRANSIT AKKA.NET
  • 23. AKKA.NET VS MASSTRANSIT MESSAGING PATTERNS ▸ At-Most-Once ▸ No Built-in At-Least- Once support ▸ Tell, Ask ▸ No Built-In Pub/Sub support ▸ At-Least-Once ▸ Send, Request/Response, Pub/Sub AKKA.NETMASSTRANSIT
  • 24. AKKA.NET VS MASSTRANSIT ROUTING ▸ Routing non-leaf level actors. ▸ Pools: create the actors (routees) messages will be routed to ▸ Groups: get routees by ref ▸ RoundRobin(Group), BroadCast(Group), ConsistentHashing(Group),
 OurOwn(Group) ▸ Routing topology auto- created ▸ Customise only via the transport API ▸ Message name(space)- based routing AKKA.NETMASSTRANSIT
  • 25. AKKA.NET VS MASSTRANSIT ERROR HANDLING ▸ coordinated▸ per handler AKKA.NETMASSTRANSIT
  • 26. AKKA.NET VS MASSTRANSIT IN-PROCESS PARALLELISM & CONCURRENCY ▸ Named Actor + Mailbox = Concurrency Checks “Avoidance” ▸ Re-use as-is in-process ▸ Threadpool ▸ Basic Parallelism ▸ Concurrency very Hard ▸ “Concurrency”Limit: ▸ = pool size ▸ No in-process support ▸ use TPL AKKA.NETMASSTRANSIT
  • 27. AKKA.NET TYPICAL SYSTEM with CQRS + ASYNC PROCESSING / * -BBB 3 B BB # / A A * 3 BB # 3 A A BC A B A C A C B BC C B 2 3 AB BCB BC C CB B B A B B CB C B BB # B 3B C 2 3 A B C A 3 3 . 3 - 3 C 2 B BC C# / A A * ( 3 A A A 2 BB C 3 AB# C A 2 BB# C B B2A A# / A A * ) 2 ACB CB C A 3 3 2CB 3 AB BCB /A C 3
  • 28. AKKA.NET FROM MASSTRANSIT TO AKKA.NET ▸ worker app serves as router for out-of-process event pub/sub ▸ command issuing apps: ▸ ref non-leaf level actors routing/life-cycle mgmt actors ▸ live in worker apps ▸ worker apps ▸ create actor hierarchy used for command and event handling
  • 29. AKKA.NET VS MASSTRANSIT INDICATIONS FOR AKKA.NET 1/3 ▸ many aggregates and very often rehydrations ▸ “hot” aggregate instances via actor lifecycle control ▸ selective disposal via actor selection and supervision ▸ massively parallel but ordered command/event handling ▸ avoid concurrency check with named actors + one mailbox per actor
  • 30. AKKA.NET VS MASSTRANSIT INDICATIONS FOR AKKA.NET 2/3 ▸ resource usage pattern vary significantly ▸ load-balanced routing ▸ infrastructure locality is important ▸ content-based routing ▸ coordination on infra error handling necessary ▸ policy-based supervision
  • 31. AKKA.NET VS MASSTRANSIT INDICATIONS FOR AKKA.NET 3/3 ▸ transport infra (RabbitMQ, AzureServiceBus, etc.) infeasible ▸ own transport ▸ stressed transport broker(ing) adds latency ▸ own transport is p2p
  • 32.
  • 34. RESILIENCY IS THE ABILITY TO WITHSTAND CERTAIN TYPES OF FAILURE AND YET REMAIN FUNCTIONAL FROM THE CUSTOMER PERSPECTIVE David Bills - Microsoft RESILIENCE
  • 35. RESILIENCE CUSTOMER BILLING: REQUIREMENTS CUSTOMER BILLING PROCESS v1 ▸ on cargo delivery to destination location 1. collect payment 2. if payment succeeds A. issue an invoice B. notify the customer for payment success + attach invoice 3. otherwise notify the customer for payment failure
  • 36. RESILIENCE CUSTOMER BILLING: INVARIANT ▸ Payment.Success
 
 AND ▸ InvoiceNumber != No.Invoice
  • 38. RESILIENCE ATTEMPT 1 - SYNC HANDLING OF DELIVERYSTATECHANGED
  • 39. RESILIENCE ATTEMPT 2 - ASYNC + RETRY
  • 40. RESILIENCE ATTEMPT 3 - ASYNC + RETRY + IDEMPOTENT 1/3 IDEMPOTENT PAYMENT COLLECTING
  • 41. RESILIENCE ATTEMPT 3 - ASYNC + RETRY + IDEMPOTENT 2/3
  • 42. RESILIENCE ATTEMPT 4 - ASYNC + RETRY + IDEMPOTENT + PROCESS DATA
  • 43. RESILIENCE ATTEMPT 4 - DISCUSSION 1/2 ▸ need to persistently maintain process data: ▸ current process state ▸ Payment Executed, Issue Invoiced etc .. ▸ output of current action ▸ = input of next action
  • 44. RESILIENCE ATTEMPT 4 - DISCUSSION 2/2 Action When State New State Data Needed Next Action Execute Payment None Payment
 Executed DeliveryState
 Changed Issue
 Invoice Issue Invoice Payment
 Executed Invoice
 Issued PaymentResult. Success & TransactionId Notify Customer Notify Customer Invoice
 Issued Customer
 Notified Invoice.Link Update Domain Update Domain Customer
 Notified Completed PaymentResult. Success & TransactionId, Invoice.Number N/A
  • 45. RESILIENCE IDEA ▸ one handler per action ▸ sets the current state ▸ sends a command (to the next handler) ▸ incl. action output (needed for next action) STILL RESILIENT ?
  • 46. RESILIENCE ATTEMPT 5 - ONE HANDLER PER ACTION
  • 47. RESILIENCE ATTEMPT 5 - DISCUSSION ▸ handlers need to know the process context ▸ to set the current state ▸ to “invoke” the next action ▸ “UpdateDomain” Command ??? INCREASED COUPLING
  • 48. RESILIENCE IDEA ▸ “action” handlers … handle only commands ▸ and emit events ▸ a “manager” handler ▸ issues the commands to the “action” handlers ▸ handles emitted events and … ▸ sets process state ▸ update the domain at the end “PROCESS MANAGER”
  • 49. RESILIENCE ATTEMPT 6 - PROCESS MANAGER BC A A BC A E A C C E C C DBC A A BBD E BBD E A C DBC A A BB C A BB C A C A BB E C E BBD E C DBC A C E C
  • 50. RESILIENCE PROCESS MANAGER in AKKA.NET BE FAIR: MASSTRANSIT SUPPORTS PROCESS MANAGERS (SAGAS)
  • 52. RESOURCES OTHER ACTOR-BASED FRAMEWORKS in .NET ▸ Orleans https://dotnet.github.io/orleans/ ▸ Virtual Actor: Cleaner syntax and semantics ▸ Less Control in Lifecycle, Supervision and Topology ▸ Proto.Actor http://proto.actor/ ▸ Closer to Orleans (Virtual Actors) but more on Supervision ▸ Lightweight and very Performant ▸ .NET Core, Go, Java and Kotlin

  • 53. RESOURCES LEARNING 1/2 ▸ Reactive Applications with AkkaNET
 https://www.manning.com/books/reactive-applications-with-akka-net
 Anthony Brown ▸ To be published in November (?) 2017 ▸ Reactive Messaging Patterns with the Actor Model: Applications and Integration http://a.co/70rOL4C
 Vaughn Vernon ▸ Scala/Java Akka ▸ Focus on messaging/EAI

  • 54. RESOURCES LEARNING 2/2 ▸ Pluralsight / Building Concurrent Applications with the Actor Model in Akka.NET 
 https://goo.gl/KXsbYn 
 Jason Roberts ▸ 8 courses in total ▸ Akka.NET Bootcamp 
 https://github.com/petabridge/akka-bootcamp
 Petabridge ▸ Free
  • 55. RESOURCES READINGS ▸ The Actor Model in 10 Minutes
 http://www.brianstorti.com/the-actor-model/
 Brian Storti ▸ Refactoring Towards Resilience Series
 https://jimmybogard.com/refactoring-towards-resilience-a-primer/ 
 Jimmy Bogard
  • 56. Q&A