SlideShare uma empresa Scribd logo
1 de 144
Baixar para ler offline
Reactive 
Domain Driven Design 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
The Objective 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
The red squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Characters 
/Alliance /Red squadron 
/Empire / DeathStar 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Attack class Alliance{ 
val squadrons = Set[Squadron]; 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
def attack(empire){ 
! 
val deathStar = empire.deathStar 
! 
squadron.foreach(squadron => 
squadron.attack(deathStar) 
) 
} 
}
Idle 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
class Squadron{ 
var location = base; 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
def attack(){ 
travelTo(deathStar){ 
… 
this.location = deathStar 
… 
} 
! 
} 
} 
Traveling
class Squadron{ 
val xwings = Set[Squadron]; 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
def attack(deathStar){ 
travelTo(deathStar) 
! 
do{ 
xwings.foreach(_.attack(deathStar)) 
}while(deathStar.alive) 
! 
} 
} 
Fighting
class XWing{ 
var healthPoints = 1 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
def attack(deathStar){ 
! 
deathStar.receiveTorpedoFrom(this) 
! 
! 
! 
! 
} 
} 
Fighting
class DeathStar{ 
var healthPoints = 100 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
def receiveTorpedoFrom(sender){ 
healthPoints -= 1 
if(senderWithoutTheForce){ 
sender.receiveTorpedoFrom(this) 
} 
} 
! 
} 
Fighting
User Story 
As the Alliance 
! 
I want to be informed of updates in state of my 
squadrons 
! 
In order to command the retreat 
of a squadron if it remains only one XWing 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Tasks 
Notification from XWing 
to Squadron Notification from 
Squadron to Alliance 
Implements 
Squadron#retreat 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Notification from XWing 
to Squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
!!! 
def receiveTorpedoFrom(sender){ 
! 
println(s”$this is dead”) 
} 
}
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val squadron = parent 
! 
def receiveTorpedoFrom(sender){ 
squadron.remove(this) 
println(s”$this is dead”) 
} 
} 
Notification from XWing 
to Squadron
} Remember 
No bidirectional 
references 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val squadron = parent 
! 
def receiveTorpedoFrom(sender){ 
squadron.remove(this) 
println(s”$this is dead”) 
} 
Notification from XWing 
to Squadron
Notification from XWing 
to Squadron 
} What would be 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val squadron = parent 
! 
def receiveTorpedoFrom(sender){ 
squadron.remove(this) 
println(s”$this is dead”) 
} 
visibility of 
remove?
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
! 
def receiveTorpedoFrom(sender){ 
println(s”$this is dead”) 
} 
! 
} 
Notification from XWing 
to Squadron
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val life = Promise[Unit]() 
! 
def receiveTorpedoFrom(sender){ 
life.success(null) 
println(s”$this is dead”) 
} 
! 
def endOfLife = life.future 
} 
Notification from XWing 
to Squadron
Notification from XWing 
to Squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val life = Promise[Unit]() 
! 
def receiveTorpedoFrom(sender){ 
life.success(null) 
println(s”$this is dead”) 
} 
! 
def endOfLife = life.future 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= xwing 
) 
) 
! 
}
Notification from XWing 
to Squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val life = Promise[Unit]() 
! 
def receiveTorpedoFrom(sender){ 
life.success(null) 
println(s”$this is dead”) 
} 
! 
def endOfLife = life.future 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= xwing 
) 
) 
! 
} Loosely coupled
Notification from XWing 
to Squadron 
But we starts with 
asynchronous 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val life = Promise[Unit]() 
! 
def receiveTorpedoFrom(sender){ 
life.success(null) 
println(s”$this is dead”) 
} 
! 
def endOfLife = life.future 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
) 
) 
! 
} Loosely coupled
Notification from XWing 
to Squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class XWing{ 
var healthPoints = 1 
! 
val life = Promise[Unit]() 
! 
def receiveTorpedoFrom(sender){ 
life.success(null) 
println(s”$this is dead”) 
} 
! 
def endOfLife = life.future 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= xwing 
) 
) 
! 
}
Tasks 
Notification from XWing 
to Squadron Notification from 
Squadron to Alliance 
Implements 
Squadron#retreat 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
! 
!!!!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
) 
) 
! 
def alliance = ??? 
}
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
! 
!!!!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
) 
) 
! 
def alliance = ??? 
} Remember again 
No bidirectional 
references
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
! 
!!!!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
) 
) 
!! 
}
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
squadrons.foreach(squadron => 
squadron.listener += { 
updatedSquadron => { 
if(updatedSquadron.currentSize < 2){ 
updatedSquadron.retreat() 
} 
} 
} 
) 
!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
listeners.foreach(l => 
l.apply(this) 
) 
) 
) 
var listeners = List[Squadron => Unit] 
! 
def currentSize = xwings.size 
! 
def retreat = ??? 
}
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
squadrons.foreach(squadron => 
squadron.listener += { 
updatedSquadron => { 
if(updatedSquadron.currentSize < 2){ 
updatedSquadron.retreat() 
} 
} 
} 
) 
!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
listeners.foreach(l => 
l.apply(this) 
) 
) 
) 
var listeners = List[Squadron => Unit] 
! 
def currentSize = xwings.size 
! 
def retreat = ??? 
} 
Will make 
the tests 
green
Notification from 
Squadron to Alliance 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Alliance{ 
val squadrons = Seq[Squadron]() 
squadrons.foreach(squadron => 
squadron.listener += { 
updatedSquadron => { 
if(updatedSquadron.currentSize < 2){ 
updatedSquadron.retreat() 
} 
} 
} 
) 
!!!! 
} 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map(_ => 
xwings -= deadXWing 
listeners.foreach(l => 
l.apply(this) 
) 
) 
) 
var listeners = List[Squadron => Unit] 
! 
def currentSize = xwings.size 
! 
def retreat = ??? 
}
Tasks 
Notification from 
Squadron to Alliance 
Implements 
Squadron#retreat 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
! 
def retreat() = ??? 
!!!!!! 
} 
Implements 
Squadron#retreat
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
! 
def retreat() = { 
travelTo(base) 
} 
!!!!! 
} 
Implements 
Squadron#retreat
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
def retreat() = { 
travelTo(base) 
} 
!!!!! 
} 
Implements 
Squadron#retreat 
That does not 
stop XWings to 
fire
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var fighting = false 
def retreat() = { 
figthing = false 
travelTo(base) 
} 
! 
def attack(deathStar){ 
travel(deathStar) 
fighting = true 
do { 
xwings.foreach(_.attack(deathStar)) 
} while (deathStar.alive && fighting) 
} 
} 
Implements 
Squadron#retreat 
Will make 
the tests 
green
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var fighting = false 
def retreat() = { 
figthing = false 
travelTo(base) 
} 
! 
def attack(deathStar){ 
travel(deathStar) 
fighting = true 
do { 
xwings.foreach(_.attack(deathStar)) 
} while (deathStar.alive && fighting) 
} 
} 
Implements 
Squadron#retreat 
But wait 
we have 
a shared 
mutable state
User Story 
As the Alliance 
! 
I want to display each modification in the status 
of my squadron 
! 
In order to see evolution of the battle 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Tasks 
Get current status 
as String 
from a Squadron 
Notification at the end 
of travels 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map { _ => 
!! 
} 
) 
!!!!! 
} 
Notification at the end 
of travels
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
! 
xwings.foreach(xwing => 
xwing.endOfLife.map { _ => 
notifyListeners() 
! 
} 
) 
! 
def attack(deathStar: DeathStar){ 
! 
travelTo(deathStar) 
notifyListeners() 
! 
} 
! 
def retreat(){ 
travelTo(base) 
notifyListeners() 
} 
} 
Notification at the end 
of travels 
Will make 
the tests 
green
Tasks 
Get current status 
as String 
from a Squadron 
Notification at the end 
of travels 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
!! 
!!!!! 
} 
Get current status 
as String 
from a Squadron
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
class Squadron{ 
var xwings = Set[XWing]() 
! 
status(“idle“) 
def attack(deathStar){ 
status(“traveling“) 
notifyListeners() 
! 
travelTo(deathStar) 
status(“figthing“) 
notifyListeners() 
} 
! 
… 
!! 
} 
Get current status 
as String 
from a Squadron 
That’s too 
much, 
there must be 
another way
Backlog 
Make the travel asynchronous 
so many squadrons can move 
at the same time 
Persist state of squadrons 
to spawn them on new VM 
if lost 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Domain Driven Design 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
http://www.amazon.fr/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Technical core concepts 
Aggregate 
Bounded context 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Technical core concepts scalability 
code 
Aggregate 
Bounded context 
transaction 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
code 
scalability 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
code 
scalability 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Knight 
Knight
code 
scalability 
Implementation 
is focused on a 
bounded context of 
the whole domain 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Knight 
Knight
code 
scalability 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
code 
scalability 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
code 
scalability 
Aggregate hides 
implementation 
details 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
code 
scalability 
Aggregate hides 
implementation 
details 
Implementation 
is focused on a 
bounded context of 
the whole domain 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Technical core concepts scalability 
code 
Aggregate 
Bounded context 
transaction 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
? 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
Root entity 
ensures 
consistency of 
the whole 
aggregate at 
any time 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
! 
can see 
4 XWings 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
When the Alliance 
can see the changes? 
! 
can see 
3 XWings 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
! 
can see 
3 XWings 
From an external 
point of view, the 
aggregate is 
eventually 
consistent! 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
transaction 
From an external 
point of view, the 
aggregate is 
eventually 
consistent! 
Root entity 
ensures 
consistency of 
the whole 
aggregate at 
any time 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Domain Driven Design 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
CQRS 
Domain Driven Design ++ 
EventSourcing 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
CQRS 
Command Query Responsibility Segregation 
Forget about 
POJOs and Java Beans 
getters/setters. 
Do semantical methods! 
You can model your 
domain twice! Once 
per usage. 
! 
Command ≠ Query 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
EventSourcing 
Forget about Hibernate 
and other ORMs. 
Persists meaningful 
past events. 
! 
Command ≠ Event 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Functional 
EventSourcing 
x (Aggregate) (Actions) Events Decision 
Command State 
making 
Events x State 
(Aggregate) 
apply State 
(Aggregate) 
+ 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Functional 
EventSourcing 
You don’t even 
need to persist 
complete aggregates 
x (Aggregate) (Actions) Events Decision 
Command State 
making 
Events x State 
(Aggregate) 
state ! 
apply State 
(Aggregate) 
+ 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Functional 
EventSourcing 
x (Aggregate) Events Decision 
Command State 
making 
Events x State 
(Aggregate) 
apply State 
(Aggregate) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Functional 
EventSourcing 
source: @thinkbeforecoding 
x (Aggregate) Events Decision 
Command State 
making 
https://github.com/thinkbeforecoding/FsUno.Prod 
Events x State 
(Aggregate) 
! 
apply State 
(Aggregate) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Command ≠ Query Command ≠ Event 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Event Actions 
Command 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Event Actions 
But where are 
the views? 
Command 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
And the views? 
You can keep 
specific views 
inside aggregates. 
You’ll bother 
the root for 
minor subjects. Lost(red-1) 
Reporter 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
And the views? 
You read events log 
and build 
ad-hoc views. 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
! 
In « real-time » 
or on demand. 
Listener 
Lost(red-1)
In DDD, aggregates and 
entities have unique 
IDs. 
So does the actors 
with paths and name 
In DDD, value object 
are everywhere and 
are immutable. 
So does case classes. 
Immutability 
help reasoning 
in concurrent 
world. 
In DDD, aggregates 
encapsulate states, 
so does actors 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Reactive 
Domain Driven Design 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Reactive 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
http://www.reactivemanifesto.org/ 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
http://www.reactivemanifesto.org/ 
asynchronous 
low coupling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
scaling to 
workload 
http://www.reactivemanifesto.org/ 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
http://www.reactivemanifesto.org/ 
sane 
error and failure 
handling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
system always responds 
in bounded latency 
http://www.reactivemanifesto.org/ 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Tasks 
Let’s do a refactor 
with Akka 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Aggregate 
Red squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Characters 
/Alliance /Red squadron 
/Empire / DeathStar 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Actors 
/Alliance /Red squadron 
/Empire / DeathStar 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Functional 
EventSourcing 
x (Aggregate) Actions Events Decision 
Command State 
making + 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Messages 
Attack ( DeathStarPath , Squadron ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Messages 
Attack ( DeathStarPath , Squadron ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Idle 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Traveling 
Sent ( Squadron, Destination ) 
Travel ( Squadron, Destination ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Traveling 
Sent ( Squadron, Destination ) 
Travel ( Squadron, Destination ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Traveling 
Arrived ( Squadron, Destination ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Traveling 
Arrived ( Squadron, Destination ) 
Arrived ( Squadron, Destination ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Fighting 
Fire ( DeathStarPath ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Fighting 
Fire ( DeathStarPath ) 
Fire ( XWingPath ) 
Lost ( Squadron, XWing ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Messages 
Attack ( DeathStarPath , Squadron ) 
Arrived ( Squadron, Destination ) 
Fire ( DeathStarPath ) 
Travel ( Squadron, Destination ) 
Sent ( Squadron, Destination ) 
Arrived ( Squadron, Destination ) 
Lost ( Squadron, Destination ) 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Fire ( XWingPath )
Algebras 
Fire x Fighting Lost 
Fighting x Lost Fighting 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Algebras 
Akka killing feature 
Fire x Fighting Lost 
! 
receive as Partial Function 
Fighting x Lost Fighting 
context.become() 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Algebras 
Think about functions 
validating inputs 
for some outputs 
Fire x Fighting Lost 
Fighting x Lost Fighting 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Algebras 
Finite State Machine 
Fire x Fighting Lost 
! 
Fighting x Lost Fighting 
For The Win 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Algebras 
NOW THE 
CODE 
Fire x Fighting Lost 
Fighting x Lost Fighting 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster akka-persistence 
http://www.reactivemanifesto.org/ 
akka-actor 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-actor 
Idle 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Attack
akka-actor 
Idle 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-actor 
Idle 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-actor 
Arrived 
Reporter 
Affected 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-actor 
Arrived Reporter 
Affected 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-actor 
Arrived 
Reporter 
Affected 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster akka-persistence 
http://www.reactivemanifesto.org/ 
akka-actor 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Idle 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Attack
akka-persistence 
Idle 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Idle 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Sent 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Sent 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Sent 
Traveling 
Eventlog 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Sent 
Eventlog 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Sent 
Eventlog 
Reporter 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Attack
akka-persistence 
Traveling 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Attack 
By default 
at-most-once delivery 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Attack
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC 
Attack
akka-persistence 
Traveling 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Ack 
at-least-once delivery 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
IFailedMasterException 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Idle 
Sent 
Eventlog 
Attack Sent 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Affected 
Eventlog 
Attack 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-persistence 
Traveling 
Sent 
Eventlog 
Recovery from EventLog 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster akka-persistence 
http://www.reactivemanifesto.org/ 
akka-actor 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
Red squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
Blue squadron Red squadron 
Green squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
Affected Affected 
Blue squadron Red squadron 
Affected Affected 
Green squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
akka-cluster 
Affected Affected 
Blue squadron Red squadron 
Affected Affected 
Green squadron 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Final notes 
Aggregate hides 
implementation 
details 
Implementation 
is focused on a 
bounded context of 
the whole domain 
Think about messages, 
Focus your attention 
on interaction 
over data 
The less actors have 
interlocutors, the better. 
Take care about 
message senders. 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
Thanks 
@xbucchiotty xbucchiotty@xebia.fr 
• EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC

Mais conteúdo relacionado

Destaque

le projet de jeu de role
le projet de jeu de rolele projet de jeu de role
le projet de jeu de role
Seo Hee Cho
 
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSIONFRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
Seo Hee Cho
 
no me llamó
no me llamóno me llamó
no me llamó
gloria
 
09 Le Couple Parfait
09 Le Couple Parfait09 Le Couple Parfait
09 Le Couple Parfait
toujoursplus
 
Orange County Diapos
Orange County DiaposOrange County Diapos
Orange County Diapos
smargeridon
 
Martine Les Nouveaux
Martine Les NouveauxMartine Les Nouveaux
Martine Les Nouveaux
pavinata
 
Diapositivas Nivel Internet
Diapositivas Nivel InternetDiapositivas Nivel Internet
Diapositivas Nivel Internet
lourdesb1
 
Reuni%Cbn De Padres
Reuni%Cbn De PadresReuni%Cbn De Padres
Reuni%Cbn De Padres
bercon
 

Destaque (20)

Michael Y Quan
Michael Y QuanMichael Y Quan
Michael Y Quan
 
Deseos de Victor hugo
Deseos de Victor hugoDeseos de Victor hugo
Deseos de Victor hugo
 
rapport luxembourg
rapport luxembourgrapport luxembourg
rapport luxembourg
 
le projet de jeu de role
le projet de jeu de rolele projet de jeu de role
le projet de jeu de role
 
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSIONFRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
FRN ROLE PLAY IN FLIGHT IN FRENCH VERSION
 
La princesa encantada
La princesa encantadaLa princesa encantada
La princesa encantada
 
Anniversairekiki2
Anniversairekiki2Anniversairekiki2
Anniversairekiki2
 
no me llamó
no me llamóno me llamó
no me llamó
 
09 Le Couple Parfait
09 Le Couple Parfait09 Le Couple Parfait
09 Le Couple Parfait
 
Que Crisis!
Que Crisis!Que Crisis!
Que Crisis!
 
nouvel an
nouvel annouvel an
nouvel an
 
Andre
AndreAndre
Andre
 
book_isr
book_isrbook_isr
book_isr
 
Orange County Diapos
Orange County DiaposOrange County Diapos
Orange County Diapos
 
Martine Les Nouveaux
Martine Les NouveauxMartine Les Nouveaux
Martine Les Nouveaux
 
El Invierno Por El Mundo
El Invierno Por El MundoEl Invierno Por El Mundo
El Invierno Por El Mundo
 
Diapositivas Nivel Internet
Diapositivas Nivel InternetDiapositivas Nivel Internet
Diapositivas Nivel Internet
 
Super Test!!
Super Test!!Super Test!!
Super Test!!
 
Reuni%Cbn De Padres
Reuni%Cbn De PadresReuni%Cbn De Padres
Reuni%Cbn De Padres
 
Slideshare
SlideshareSlideshare
Slideshare
 

Semelhante a Reactive Domain Driven Design - elsassjug

Scala-对Java的修正和超越
Scala-对Java的修正和超越Scala-对Java的修正和超越
Scala-对Java的修正和超越
Caoyuan Deng
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
Tomasz Wrobel
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
jeffz
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
djspiewak
 

Semelhante a Reactive Domain Driven Design - elsassjug (10)

Scala-对Java的修正和超越
Scala-对Java的修正和超越Scala-对Java的修正和超越
Scala-对Java的修正和超越
 
Scala for ruby programmers
Scala for ruby programmersScala for ruby programmers
Scala for ruby programmers
 
Gremlin's Graph Traversal Machinery
Gremlin's Graph Traversal MachineryGremlin's Graph Traversal Machinery
Gremlin's Graph Traversal Machinery
 
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
 
Calculus II - 29
Calculus II - 29Calculus II - 29
Calculus II - 29
 
Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)Jscex: Write Sexy JavaScript (中文)
Jscex: Write Sexy JavaScript (中文)
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
2.3 implicits
2.3 implicits2.3 implicits
2.3 implicits
 

Mais de Publicis Sapient Engineering

Mais de Publicis Sapient Engineering (20)

XebiCon'18 - L'algorithme de reconnaissance de formes par le cerveau humain
XebiCon'18 - L'algorithme de reconnaissance de formes par le cerveau humainXebiCon'18 - L'algorithme de reconnaissance de formes par le cerveau humain
XebiCon'18 - L'algorithme de reconnaissance de formes par le cerveau humain
 
Xebicon'18 - IoT: From Edge to Cloud
Xebicon'18 - IoT: From Edge to CloudXebicon'18 - IoT: From Edge to Cloud
Xebicon'18 - IoT: From Edge to Cloud
 
Xebicon'18 - Spark in jail : conteneurisez vos traitements data sans serveur
Xebicon'18 - Spark in jail : conteneurisez vos traitements data sans serveurXebicon'18 - Spark in jail : conteneurisez vos traitements data sans serveur
Xebicon'18 - Spark in jail : conteneurisez vos traitements data sans serveur
 
XebiCon'18 - Modern Infrastructure
XebiCon'18 - Modern InfrastructureXebiCon'18 - Modern Infrastructure
XebiCon'18 - Modern Infrastructure
 
XebiCon'18 - La Web App d'aujourd'hui et de demain : état de l'art et bleedin...
XebiCon'18 - La Web App d'aujourd'hui et de demain : état de l'art et bleedin...XebiCon'18 - La Web App d'aujourd'hui et de demain : état de l'art et bleedin...
XebiCon'18 - La Web App d'aujourd'hui et de demain : état de l'art et bleedin...
 
XebiCon'18 - Des notebook pour le monitoring avec Zeppelin
XebiCon'18 - Des notebook pour le monitoring avec Zeppelin XebiCon'18 - Des notebook pour le monitoring avec Zeppelin
XebiCon'18 - Des notebook pour le monitoring avec Zeppelin
 
XebiCon'18 - Event Sourcing et RGPD, incompatibles ?
XebiCon'18 - Event Sourcing et RGPD, incompatibles ?XebiCon'18 - Event Sourcing et RGPD, incompatibles ?
XebiCon'18 - Event Sourcing et RGPD, incompatibles ?
 
XebiCon'18 - Deno, le nouveau NodeJS qui inverse la tendance ?
XebiCon'18 - Deno, le nouveau NodeJS qui inverse la tendance ?XebiCon'18 - Deno, le nouveau NodeJS qui inverse la tendance ?
XebiCon'18 - Deno, le nouveau NodeJS qui inverse la tendance ?
 
XebiCon'18 - Boostez vos modèles avec du Deep Learning distribué
XebiCon'18 - Boostez vos modèles avec du Deep Learning distribuéXebiCon'18 - Boostez vos modèles avec du Deep Learning distribué
XebiCon'18 - Boostez vos modèles avec du Deep Learning distribué
 
XebiCon'18 - Comment j'ai développé un jeu vidéo avec des outils de développe...
XebiCon'18 - Comment j'ai développé un jeu vidéo avec des outils de développe...XebiCon'18 - Comment j'ai développé un jeu vidéo avec des outils de développe...
XebiCon'18 - Comment j'ai développé un jeu vidéo avec des outils de développe...
 
XebiCon'18 - Les utilisateurs finaux, les oubliés de nos produits !
XebiCon'18 - Les utilisateurs finaux, les oubliés de nos produits !XebiCon'18 - Les utilisateurs finaux, les oubliés de nos produits !
XebiCon'18 - Les utilisateurs finaux, les oubliés de nos produits !
 
XebiCon'18 - Comment fausser l'interprétation de vos résultats avec des dataviz
XebiCon'18 - Comment fausser l'interprétation de vos résultats avec des datavizXebiCon'18 - Comment fausser l'interprétation de vos résultats avec des dataviz
XebiCon'18 - Comment fausser l'interprétation de vos résultats avec des dataviz
 
XebiCon'18 - Le développeur dans la Pop Culture
XebiCon'18 - Le développeur dans la Pop Culture XebiCon'18 - Le développeur dans la Pop Culture
XebiCon'18 - Le développeur dans la Pop Culture
 
XebiCon'18 - Architecturer son application mobile pour la durabilité
XebiCon'18 - Architecturer son application mobile pour la durabilitéXebiCon'18 - Architecturer son application mobile pour la durabilité
XebiCon'18 - Architecturer son application mobile pour la durabilité
 
XebiCon'18 - Sécuriser son API avec OpenID Connect
XebiCon'18 - Sécuriser son API avec OpenID ConnectXebiCon'18 - Sécuriser son API avec OpenID Connect
XebiCon'18 - Sécuriser son API avec OpenID Connect
 
XebiCon'18 - Structuration du Temps et Dynamique de Groupes, Théorie organisa...
XebiCon'18 - Structuration du Temps et Dynamique de Groupes, Théorie organisa...XebiCon'18 - Structuration du Temps et Dynamique de Groupes, Théorie organisa...
XebiCon'18 - Structuration du Temps et Dynamique de Groupes, Théorie organisa...
 
XebiCon'18 - Spark NLP, un an après
XebiCon'18 - Spark NLP, un an aprèsXebiCon'18 - Spark NLP, un an après
XebiCon'18 - Spark NLP, un an après
 
XebiCon'18 - La sécurité, douce illusion même en 2018
XebiCon'18 - La sécurité, douce illusion même en 2018XebiCon'18 - La sécurité, douce illusion même en 2018
XebiCon'18 - La sécurité, douce illusion même en 2018
 
XebiCon'18 - Utiliser Hyperledger Fabric pour la création d'une blockchain pr...
XebiCon'18 - Utiliser Hyperledger Fabric pour la création d'une blockchain pr...XebiCon'18 - Utiliser Hyperledger Fabric pour la création d'une blockchain pr...
XebiCon'18 - Utiliser Hyperledger Fabric pour la création d'une blockchain pr...
 
XebiCon'18 - Ce que l'histoire du métro Parisien m'a enseigné sur la création...
XebiCon'18 - Ce que l'histoire du métro Parisien m'a enseigné sur la création...XebiCon'18 - Ce que l'histoire du métro Parisien m'a enseigné sur la création...
XebiCon'18 - Ce que l'histoire du métro Parisien m'a enseigné sur la création...
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Último (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Reactive Domain Driven Design - elsassjug

  • 1. Reactive Domain Driven Design • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 2. The Objective • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 3. The red squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 4. Characters /Alliance /Red squadron /Empire / DeathStar • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 5. Attack class Alliance{ val squadrons = Set[Squadron]; • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! def attack(empire){ ! val deathStar = empire.deathStar ! squadron.foreach(squadron => squadron.attack(deathStar) ) } }
  • 6. Idle • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 7. class Squadron{ var location = base; • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! def attack(){ travelTo(deathStar){ … this.location = deathStar … } ! } } Traveling
  • 8. class Squadron{ val xwings = Set[Squadron]; • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! def attack(deathStar){ travelTo(deathStar) ! do{ xwings.foreach(_.attack(deathStar)) }while(deathStar.alive) ! } } Fighting
  • 9. class XWing{ var healthPoints = 1 • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! def attack(deathStar){ ! deathStar.receiveTorpedoFrom(this) ! ! ! ! } } Fighting
  • 10. class DeathStar{ var healthPoints = 100 • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! def receiveTorpedoFrom(sender){ healthPoints -= 1 if(senderWithoutTheForce){ sender.receiveTorpedoFrom(this) } } ! } Fighting
  • 11. User Story As the Alliance ! I want to be informed of updates in state of my squadrons ! In order to command the retreat of a squadron if it remains only one XWing • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 12. Tasks Notification from XWing to Squadron Notification from Squadron to Alliance Implements Squadron#retreat • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 13. Notification from XWing to Squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 !!! def receiveTorpedoFrom(sender){ ! println(s”$this is dead”) } }
  • 14. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val squadron = parent ! def receiveTorpedoFrom(sender){ squadron.remove(this) println(s”$this is dead”) } } Notification from XWing to Squadron
  • 15. } Remember No bidirectional references • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val squadron = parent ! def receiveTorpedoFrom(sender){ squadron.remove(this) println(s”$this is dead”) } Notification from XWing to Squadron
  • 16. Notification from XWing to Squadron } What would be • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val squadron = parent ! def receiveTorpedoFrom(sender){ squadron.remove(this) println(s”$this is dead”) } visibility of remove?
  • 17. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! ! def receiveTorpedoFrom(sender){ println(s”$this is dead”) } ! } Notification from XWing to Squadron
  • 18. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val life = Promise[Unit]() ! def receiveTorpedoFrom(sender){ life.success(null) println(s”$this is dead”) } ! def endOfLife = life.future } Notification from XWing to Squadron
  • 19. Notification from XWing to Squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val life = Promise[Unit]() ! def receiveTorpedoFrom(sender){ life.success(null) println(s”$this is dead”) } ! def endOfLife = life.future } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= xwing ) ) ! }
  • 20. Notification from XWing to Squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val life = Promise[Unit]() ! def receiveTorpedoFrom(sender){ life.success(null) println(s”$this is dead”) } ! def endOfLife = life.future } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= xwing ) ) ! } Loosely coupled
  • 21. Notification from XWing to Squadron But we starts with asynchronous • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val life = Promise[Unit]() ! def receiveTorpedoFrom(sender){ life.success(null) println(s”$this is dead”) } ! def endOfLife = life.future } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing ) ) ! } Loosely coupled
  • 22. Notification from XWing to Squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class XWing{ var healthPoints = 1 ! val life = Promise[Unit]() ! def receiveTorpedoFrom(sender){ life.success(null) println(s”$this is dead”) } ! def endOfLife = life.future } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= xwing ) ) ! }
  • 23. Tasks Notification from XWing to Squadron Notification from Squadron to Alliance Implements Squadron#retreat • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 24. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() ! !!!!!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing ) ) ! def alliance = ??? }
  • 25. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() ! !!!!!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing ) ) ! def alliance = ??? } Remember again No bidirectional references
  • 26. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() ! !!!!!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing ) ) !! }
  • 27. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() squadrons.foreach(squadron => squadron.listener += { updatedSquadron => { if(updatedSquadron.currentSize < 2){ updatedSquadron.retreat() } } } ) !!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing listeners.foreach(l => l.apply(this) ) ) ) var listeners = List[Squadron => Unit] ! def currentSize = xwings.size ! def retreat = ??? }
  • 28. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() squadrons.foreach(squadron => squadron.listener += { updatedSquadron => { if(updatedSquadron.currentSize < 2){ updatedSquadron.retreat() } } } ) !!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing listeners.foreach(l => l.apply(this) ) ) ) var listeners = List[Squadron => Unit] ! def currentSize = xwings.size ! def retreat = ??? } Will make the tests green
  • 29. Notification from Squadron to Alliance • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Alliance{ val squadrons = Seq[Squadron]() squadrons.foreach(squadron => squadron.listener += { updatedSquadron => { if(updatedSquadron.currentSize < 2){ updatedSquadron.retreat() } } } ) !!!! } class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map(_ => xwings -= deadXWing listeners.foreach(l => l.apply(this) ) ) ) var listeners = List[Squadron => Unit] ! def currentSize = xwings.size ! def retreat = ??? }
  • 30. Tasks Notification from Squadron to Alliance Implements Squadron#retreat • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 31. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() ! def retreat() = ??? !!!!!! } Implements Squadron#retreat
  • 32. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() ! def retreat() = { travelTo(base) } !!!!! } Implements Squadron#retreat
  • 33. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() def retreat() = { travelTo(base) } !!!!! } Implements Squadron#retreat That does not stop XWings to fire
  • 34. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var fighting = false def retreat() = { figthing = false travelTo(base) } ! def attack(deathStar){ travel(deathStar) fighting = true do { xwings.foreach(_.attack(deathStar)) } while (deathStar.alive && fighting) } } Implements Squadron#retreat Will make the tests green
  • 35. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var fighting = false def retreat() = { figthing = false travelTo(base) } ! def attack(deathStar){ travel(deathStar) fighting = true do { xwings.foreach(_.attack(deathStar)) } while (deathStar.alive && fighting) } } Implements Squadron#retreat But wait we have a shared mutable state
  • 36. User Story As the Alliance ! I want to display each modification in the status of my squadron ! In order to see evolution of the battle • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 37. Tasks Get current status as String from a Squadron Notification at the end of travels • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 38. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map { _ => !! } ) !!!!! } Notification at the end of travels
  • 39. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() ! xwings.foreach(xwing => xwing.endOfLife.map { _ => notifyListeners() ! } ) ! def attack(deathStar: DeathStar){ ! travelTo(deathStar) notifyListeners() ! } ! def retreat(){ travelTo(base) notifyListeners() } } Notification at the end of travels Will make the tests green
  • 40. Tasks Get current status as String from a Squadron Notification at the end of travels • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 41. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() !! !!!!! } Get current status as String from a Squadron
  • 42. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC class Squadron{ var xwings = Set[XWing]() ! status(“idle“) def attack(deathStar){ status(“traveling“) notifyListeners() ! travelTo(deathStar) status(“figthing“) notifyListeners() } ! … !! } Get current status as String from a Squadron That’s too much, there must be another way
  • 43. Backlog Make the travel asynchronous so many squadrons can move at the same time Persist state of squadrons to spawn them on new VM if lost • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 44. Domain Driven Design • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 46. Technical core concepts Aggregate Bounded context • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 47. Technical core concepts scalability code Aggregate Bounded context transaction • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 48. code scalability • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 49. code scalability • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Knight Knight
  • 50. code scalability Implementation is focused on a bounded context of the whole domain • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Knight Knight
  • 51. code scalability • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 52. code scalability • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 53. code scalability Aggregate hides implementation details • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 54. code scalability Aggregate hides implementation details Implementation is focused on a bounded context of the whole domain • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 55. Technical core concepts scalability code Aggregate Bounded context transaction • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 56. transaction • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 57. transaction • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 58. transaction ? • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 59. transaction Root entity ensures consistency of the whole aggregate at any time • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 60. transaction ! can see 4 XWings • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 61. transaction When the Alliance can see the changes? ! can see 3 XWings • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 62. transaction ! can see 3 XWings From an external point of view, the aggregate is eventually consistent! • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 63. transaction From an external point of view, the aggregate is eventually consistent! Root entity ensures consistency of the whole aggregate at any time • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 64. Domain Driven Design • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 65. CQRS Domain Driven Design ++ EventSourcing • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 66. CQRS Command Query Responsibility Segregation Forget about POJOs and Java Beans getters/setters. Do semantical methods! You can model your domain twice! Once per usage. ! Command ≠ Query • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 67. EventSourcing Forget about Hibernate and other ORMs. Persists meaningful past events. ! Command ≠ Event • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 68. Functional EventSourcing x (Aggregate) (Actions) Events Decision Command State making Events x State (Aggregate) apply State (Aggregate) + • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 69. Functional EventSourcing You don’t even need to persist complete aggregates x (Aggregate) (Actions) Events Decision Command State making Events x State (Aggregate) state ! apply State (Aggregate) + • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 70. Functional EventSourcing x (Aggregate) Events Decision Command State making Events x State (Aggregate) apply State (Aggregate) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 71. Functional EventSourcing source: @thinkbeforecoding x (Aggregate) Events Decision Command State making https://github.com/thinkbeforecoding/FsUno.Prod Events x State (Aggregate) ! apply State (Aggregate) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 72. Command ≠ Query Command ≠ Event • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 73. Event Actions Command • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 74. Event Actions But where are the views? Command • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 75. And the views? You can keep specific views inside aggregates. You’ll bother the root for minor subjects. Lost(red-1) Reporter • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 76. And the views? You read events log and build ad-hoc views. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC ! In « real-time » or on demand. Listener Lost(red-1)
  • 77. In DDD, aggregates and entities have unique IDs. So does the actors with paths and name In DDD, value object are everywhere and are immutable. So does case classes. Immutability help reasoning in concurrent world. In DDD, aggregates encapsulate states, so does actors • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 78. Reactive Domain Driven Design • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 79. Reactive • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 80. http://www.reactivemanifesto.org/ • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 81. http://www.reactivemanifesto.org/ asynchronous low coupling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 82. scaling to workload http://www.reactivemanifesto.org/ • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 83. http://www.reactivemanifesto.org/ sane error and failure handling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 84. system always responds in bounded latency http://www.reactivemanifesto.org/ • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 85. Tasks Let’s do a refactor with Akka • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 86. Aggregate Red squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 87. Characters /Alliance /Red squadron /Empire / DeathStar • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 88. Actors /Alliance /Red squadron /Empire / DeathStar • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 89. Functional EventSourcing x (Aggregate) Actions Events Decision Command State making + • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 90. Messages Attack ( DeathStarPath , Squadron ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 91. Messages Attack ( DeathStarPath , Squadron ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 92. Idle • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 93. Traveling Sent ( Squadron, Destination ) Travel ( Squadron, Destination ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 94. Traveling Sent ( Squadron, Destination ) Travel ( Squadron, Destination ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 95. Traveling Arrived ( Squadron, Destination ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 96. Traveling Arrived ( Squadron, Destination ) Arrived ( Squadron, Destination ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 97. Fighting Fire ( DeathStarPath ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 98. Fighting Fire ( DeathStarPath ) Fire ( XWingPath ) Lost ( Squadron, XWing ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 99. Messages Attack ( DeathStarPath , Squadron ) Arrived ( Squadron, Destination ) Fire ( DeathStarPath ) Travel ( Squadron, Destination ) Sent ( Squadron, Destination ) Arrived ( Squadron, Destination ) Lost ( Squadron, Destination ) • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Fire ( XWingPath )
  • 100. Algebras Fire x Fighting Lost Fighting x Lost Fighting • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 101. Algebras Akka killing feature Fire x Fighting Lost ! receive as Partial Function Fighting x Lost Fighting context.become() • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 102. Algebras Think about functions validating inputs for some outputs Fire x Fighting Lost Fighting x Lost Fighting • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 103. Algebras Finite State Machine Fire x Fighting Lost ! Fighting x Lost Fighting For The Win • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 104. Algebras NOW THE CODE Fire x Fighting Lost Fighting x Lost Fighting • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 105. akka-cluster akka-persistence http://www.reactivemanifesto.org/ akka-actor • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 106. akka-actor Idle • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Attack
  • 107. akka-actor Idle Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 108. akka-actor Idle Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 109. akka-actor Arrived Reporter Affected • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 110. akka-actor Arrived Reporter Affected • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 111. akka-actor Arrived Reporter Affected • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 112. akka-cluster akka-persistence http://www.reactivemanifesto.org/ akka-actor • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 113. akka-persistence Idle • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Attack
  • 114. akka-persistence Idle Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 115. akka-persistence Idle Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 116. akka-persistence Sent Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 117. akka-persistence Sent Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 118. akka-persistence Sent Traveling Eventlog • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 119. akka-persistence Traveling Sent Eventlog • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 120. akka-persistence Traveling Sent Eventlog Reporter • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 121. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Attack
  • 122. akka-persistence Traveling Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 123. akka-persistence Traveling Attack By default at-most-once delivery • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 124. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Attack
  • 125. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC Attack
  • 126. akka-persistence Traveling Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 127. akka-persistence Traveling Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 128. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 129. akka-persistence Traveling Ack at-least-once delivery • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 130. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 131. akka-persistence Traveling IFailedMasterException • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 132. akka-persistence Traveling • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 133. akka-persistence Idle Sent Eventlog Attack Sent • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 134. akka-persistence Traveling Affected Eventlog Attack • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 135. akka-persistence Traveling Sent Eventlog Recovery from EventLog • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 136. akka-cluster akka-persistence http://www.reactivemanifesto.org/ akka-actor • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 137. akka-cluster • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 138. akka-cluster • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 139. akka-cluster Red squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 140. akka-cluster Blue squadron Red squadron Green squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 141. akka-cluster Affected Affected Blue squadron Red squadron Affected Affected Green squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 142. akka-cluster Affected Affected Blue squadron Red squadron Affected Affected Green squadron • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 143. Final notes Aggregate hides implementation details Implementation is focused on a bounded context of the whole domain Think about messages, Focus your attention on interaction over data The less actors have interlocutors, the better. Take care about message senders. • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC
  • 144. Thanks @xbucchiotty xbucchiotty@xebia.fr • EBIA ALLIANCE = XEBIA + XEBIALABS + THIGA + UX REPUBLIC