SlideShare a Scribd company logo
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence, CQRS/ES y otras
siglas del montón
Javier Santos
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
About us
Javier Santos @jpaniego
«Hay dos formas de programar sin
errores; sólo la tercera funciona»
Alan J Perlis
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalera.es
@scalerablog
About us
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem to solve
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem to solve
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem to solve
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
DDD - Domain Driven Design
● Context - The setting in which a word or statement appears that
determines its meaning
● Domain (Ontology) - The subject area to which the user applies a
program is the domain of the software
● Model - A system of abstractions that describes selected aspects of a
domain and can be used to solve problems related to that domain
● Ubiquitous language - A language structured around the domain model
and used by all team members to connect all the activities of the team
with the software
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
DDD - Domain Driven Design
● Context - The setting in which a word or statement appears that
determines its meaning
● Domain (Ontology) - The subject area to which the user applies a
program is the domain of the software
● Model - A system of abstractions that describes selected aspects of a
domain and can be used to solve problems related to that domain
● Ubiquitous language - A language structured around the domain model
and used by all team members to connect all the activities of the team
with the software
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
DDD - Domain Driven Design
● Context - The setting in which a word or statement appears that
determines its meaning
● Domain (Ontology) - The subject area to which the user applies a
program is the domain of the software
● Model - A system of abstractions that describes selected aspects of a
domain and can be used to solve problems related to that domain
● Ubiquitous language - A language structured around the domain model
and used by all team members to connect all the activities of the team
with the software
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Our domain model
case class User(
name: String,
address: Address,
credit: Double,
currentBike: Option[Id[Bike]])
case class Bike(
model: String,
battery: Bike.Battery.Status,
bikeStation: Option[Id[Station]])
case class Address(
street: String,
number: String,
zipCode: String)
case class Station(
address: Address,
maxBikeCapacity: Int,
currentCapacity: Int)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Anemic Domain Model
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Anemic Domain Model
● Think about a domain class that only contains fields and no
methods.
● Anti-pattern against the main idea of the object-oriented
programming paradigm: combining data and process
together.
● Why not using C structs then? ¬¬
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Anemic Domain Model
case class User(
name: String,
address: Address,
credit: Double,
currentBike: Option[Id[Bike]]) {
def startRental(bike: Id[Bike]): User = {
require(
currentBike.isEmpty,"There's another rental on course.")
require(
credit > 0, "Not enough credit to start a rental.")
this.copy(currentBike = Some(bike))
}
//...
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Anemic Domain Model
//...
def finishRental(creditExpense: Double): User = {
require(
currentBike.isDefined, "There is not a rental on course.")
this.copy(
currentBike = None,
credit = credit - creditExpense)
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Aggregate
● Cluster of domain objects
● The whole block of domain objects works as a sole entity.
User Bike
Address
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Aggregate
trait Aggregate extends ...{
def id: Id[This]
}
case class Station(
address: Address,
maxBikeCapacity: Int,
currentCapacity: Int)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Event Sourcing
● “Every change to the state of an application is captured in an event
object, and that these event objects are themselves stored in the
sequence they were applied for the same lifetime as the application state
itself” - Martin Fowler
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Event Sourcing
● The system state is the sum of the events
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Stateful[T]
trait Stateful[S] {
type This <: Stateful[S]
type Action = scalaz.State[S, Event]
val state: S
def apply(s: S): This
def update(f: Action): (This, E) = {
val (newState, e) = f(state)
(apply(newState), e)
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalaz.State
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalaz.State
● Represents a state mutation that may generate some effect.
● type State[S, Effect] = StateT[Id, S, Effect]
● Monad = composable!
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalaz.State
type Action[E] = scalaz.State[User, E]
def addCredit(amount: Double): Action[Double] =
State(user =>
(user.copy(credit = user.credit + amount), amount))
def rentBike(bike: Id[Bike], timesUsed: Long): Action[Long] =
State(user =>
(user.copy(currentBike = Some(bike), timesUsed + 1))
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalaz.State
val topUpAndRent: Action[(Double, Long)] =
for {
newCredit <- addCredit(10)
timesUsed <- rentBike(Id(“bike-1”))
} yield (newCredit, timesUsed)
val (relaxingAnn, (newCredit, bikeAge)) =
topUpAndRent(User(“Ann Bottle”, Addres(...), 0.0, None)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Immutability perversion
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
StatefulAgg[T]
trait StateAgg[S] extends Stateful[S]{
_: PersistenActor =>
var aggState: S
def updateState(f: Action): Unit = {
val (newAgg, _) = update(f)
aggState = newAgg.state
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
StatefulAgg[T]
trait StateAgg[S] extends Stateful[S]{
_: PersistenActor =>
var aggState: S
def updateState(f: Action): Unit = {
val (newAgg, _) = update(f)
aggState = newAgg.state
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
CQRS
● Command Query Responsibility Segregation
● Main idea: “You can use a different model to update the
information than the model you use to read information”
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
CQRS
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
CQRS
trait Command[Agg] {
val to: Id[Agg]
}
trait Event
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence
● End of 2013
● Martin Krasser
● Main idea : store the internal state of an actor
● ...BUT not directly, only through the changes the actor has
suffered.
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence - Failure recovery
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence - Failure recovery
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence - Failure recovery
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence - Failure recovery
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Snapshotting
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Snapshotting
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Persistent actors
trait PersistenceStuff extends PersistentActor{
def persistenceId: String
def receiveCommand: Receive
def receiveRecover: Receive
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
trait Reactive { _: Stateful[S] =>
val onEvent: Event => Action
val onSnapshot: Any => Action = {
case snapshot => State(s => (s, snapshot))
}
def asEvent(c: Command[This]): Event
}
Persistent actors
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
trait Aggregate[S] extends StateAgg[S] with Reactive with PersistentActor {
def persistenceId: String = id.id
def receiveRecover: Receive = {
case event: Event => update(onEvent(event))
case snapshot => update(onSnapshot(snapshot))
}
def receiveCommand: Receive = {
case cmd: Command[This@unchecked] =>
if (checkState(cmd))
persistAll(List(asEvent(cmd))){ event =>
update(onEvent(event))
sender ! event
}
else sender ! Nope
}
}
Persistent actors
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
case class UserAgg(state: User.Default) extends Aggregate[User] {
type This = UserAgg
def apply(s: User) = UserAgg(s)
override val onEvent = {
case e@AddedCredit(amount) =>
State(s => (s.copy(credit = s.credit+10),e))
}
def asEvent(c: Command[This]): Event = c match {
case AddCredit(_, amount) => AddedCredit(amount)
}
}
Persistent actors
boilerplate
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Persistence Queries
● Like a PersistentActor but with no Command part
● peristenceId subscription or by tag
● refreshInterval in most plugins
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Persistence Queries
val readJournal =
PersistenceQuery(system).readJournalFor[MyScaladslReadJournal](
"akka.persistence.query.my-read-journal")
// issue query to journal
val source: Source[EventEnvelope, NotUsed] =
readJournal.eventsByPersistenceId("user-1337")
// materialize stream, consuming events
implicit val mat = ActorMaterializer()
source.runForeach { event => println("Event: " + event) }
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
getOrCreate
● A new command is launched against user1...how to deliver it?
● Managers
class UserManager extends Actor {
override def receive = {
case cmd: Command[User@unchecked] =>
getOrCreate(cmd.addresse) forward cmd
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
getOrCreate
● Imagine there are 500k registered users …
● ...you create a persistent actor and deliver the just arrived
command…
● ...the actor keeps alive….
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
getOrCreate
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Passivation
● Kill the actor if it’s iddle…
trait Passivation extends PersistentActor {
import ShardRegion.Passivate
context.setReceiveTimeout(60.seconds)
override def receiveCommand = {
//…
case ReceiveTimeout =>
context.parent ! Passivate(stopMessage = Stop)
}
}
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Journal
● Different supported pluggable storages:
○ AndroidSQLite
○ BDB
○ Cassandra
○ Kafka
○ DynamoDB
○ HBase
○ MongoDB
○ …
● Why choosing a distributed database as Journal for High Availability?
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
HA : Clustering
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
HA : Clustering
● Send semantics
○ Send: The message is sent to an only cluster actor that fits in the
path. If several, the actor is chosen randomly.
clusterClient ! Send(«/user/handler», «hello»,
localAffinity = true)
○ SendToAll: The message is sent to all cluster actors that fit in the
path.
clusterClient ! SendToAll(«/user/handler», «hi»)
○ Publish: The message is sent to all topic subscribers
clusterClient ! Publish(«myTopic», «hello»)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Partitioning : Sharding
● Study case:
○ A command is sent (in a cluster)
to aggregate1, the actor is
created in node1, the command is
processed.
○ A second command is sent (in the
same cluster) to aggregate1, but
this time the command is
received by node2, so the actor is
created there.
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Partitioning : Sharding
● It provides
○ Load balancing: In case a new is added to the cluster or
another one crashes, the total actor amount is balanced.
○ Unique actor identification, so messages that are sent to the
same actor will be forwarded to the node that handles in that
moment that shard id (previous case won’t take place)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Partitioning : Sharding
● Semantics
○ Entry: It represents a uniquely identified entity with
persistent state (Aggregate).
○ Shard: Entry group. Experts recommend
ShardAmount = 10 x MaxNodeAmount
○ ShardRegion: Same Entry shard group.
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Partitioning : Sharding
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
#graciasCarmena
#llevameEnTuBiciceta
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: eventual consistency
● Changes may take
some time
● If the user requires an
immediate update,
user views could be
updated when the
command part has
acknowledge the event
persistence (handle it
carefully...)
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: Distributed transactions
● Let’s suppose credit transfer is allowed among users
● Saga Pattern: A persistent actor that represents a
transaction among aggregates
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: Distributed transactions
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: cluster initialization
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: cluster initialization
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: cluster initialization
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: cluster initialization
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: Testing a PersistentActor
TestActorRef + PersistentActor =
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem: Testing a PersistentActor
TestActorRef + PersistentActor =
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Problem : Schema evolution
● Imagine the following:
case class User(name: String, address: Address, amount: Double)
case class User(cardId: String, amount: Double, usualBike: Bike)
● Choosing proper serializers are the key (ProtoBuf, Avro, Java ser...no
way)
● Event migration (EventAdapter)
● How to:
○ add attribute
○ remove attribute
○ rename attribute
○ ...
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Lightbend approach
● Runs on JRE 1.8
● Multiple service control
● Event stream abstraction
● Easy scalability
● Java SDK ...
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Lightbend approach
● Runs on JRE 1.8
● Multiple service control
● Event stream abstraction
● Easy scalability
● Java SDK ...
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
scalera.es
@scalerablog
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
MADRID · NOV 18-19 · 2016
Scala Programming @ Madrid
Akka persistence, CQRS/ES y otras
siglas del montón
Javier Santos

More Related Content

What's hot

Collection advance
Collection advanceCollection advance
Collection advance
Aakash Jain
 
Spark: Taming Big Data
Spark: Taming Big DataSpark: Taming Big Data
Spark: Taming Big Data
Leonardo Gamas
 
Time Series With OrientDB - Fosdem 2015
Time Series With OrientDB - Fosdem 2015Time Series With OrientDB - Fosdem 2015
Time Series With OrientDB - Fosdem 2015
wolf4ood
 
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
NETWAYS
 
A Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache SparkA Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache Spark
datamantra
 
Geospatial Graphs made easy with OrientDB - Codemotion Spain
Geospatial Graphs made easy with OrientDB - Codemotion SpainGeospatial Graphs made easy with OrientDB - Codemotion Spain
Geospatial Graphs made easy with OrientDB - Codemotion Spain
Luigi Dell'Aquila
 
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDBGeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
Luigi Dell'Aquila
 
Introduction to dataset
Introduction to datasetIntroduction to dataset
Introduction to dataset
datamantra
 
Reactive programming with RxSwift
Reactive programming with RxSwiftReactive programming with RxSwift
Reactive programming with RxSwift
Oleksandr Stepanov
 
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
Luigi Dell'Aquila
 
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development ModelLaskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
Garindra Prahandono
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
維然 柯維然
 
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Andrew Rota
 
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
Qbeast
 
RxJava in practice
RxJava in practice RxJava in practice
RxJava in practice
Javier Gamarra
 
Cassandra for impatients
Cassandra for impatientsCassandra for impatients
Cassandra for impatients
Carlos Alonso Pérez
 

What's hot (17)

Collection advance
Collection advanceCollection advance
Collection advance
 
Spark: Taming Big Data
Spark: Taming Big DataSpark: Taming Big Data
Spark: Taming Big Data
 
Time Series With OrientDB - Fosdem 2015
Time Series With OrientDB - Fosdem 2015Time Series With OrientDB - Fosdem 2015
Time Series With OrientDB - Fosdem 2015
 
Chapter03b
Chapter03bChapter03b
Chapter03b
 
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
OSDC 2016 - Chronix - A fast and efficient time series storage based on Apach...
 
A Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache SparkA Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache Spark
 
Geospatial Graphs made easy with OrientDB - Codemotion Spain
Geospatial Graphs made easy with OrientDB - Codemotion SpainGeospatial Graphs made easy with OrientDB - Codemotion Spain
Geospatial Graphs made easy with OrientDB - Codemotion Spain
 
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDBGeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
GeeCON Prague 2016 - Geospatial Graphs made easy with OrientDB
 
Introduction to dataset
Introduction to datasetIntroduction to dataset
Introduction to dataset
 
Reactive programming with RxSwift
Reactive programming with RxSwiftReactive programming with RxSwift
Reactive programming with RxSwift
 
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
Geospatial Graphs made easy with OrientDB - Codemotion Milan 2016
 
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development ModelLaskar: High-Velocity GraphQL & Lambda-based Software Development Model
Laskar: High-Velocity GraphQL & Lambda-based Software Development Model
 
Scheme 核心概念(一)
Scheme 核心概念(一)Scheme 核心概念(一)
Scheme 核心概念(一)
 
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)Performant APIs with GraphQL and PHP (Dutch PHP 2019)
Performant APIs with GraphQL and PHP (Dutch PHP 2019)
 
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
Extending Spark for Qbeast's SQL Data Source​ with Paola Pardo and Cesare Cug...
 
RxJava in practice
RxJava in practice RxJava in practice
RxJava in practice
 
Cassandra for impatients
Cassandra for impatientsCassandra for impatients
Cassandra for impatients
 

Viewers also liked

Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
Sander Mak (@Sander_Mak)
 
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Yanik Berube
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinarpatriknw
 
Akka Persistence | Event Sourcing
Akka Persistence | Event SourcingAkka Persistence | Event Sourcing
Akka Persistence | Event Sourcing
Knoldus Inc.
 
Reactive programming with scala and akka
Reactive programming with scala and akkaReactive programming with scala and akka
Reactive programming with scala and akka
Knoldus Inc.
 
Akka Streams
Akka StreamsAkka Streams
Akka Streams
Diego Pacheco
 
Event Sourcing using Akka on AWS
Event Sourcing using Akka on AWSEvent Sourcing using Akka on AWS
Event Sourcing using Akka on AWS
Daniel Pfeiffer
 
Akka-http
Akka-httpAkka-http
Akka-http
Iosif Itkin
 
CQRS+ESをAkka Persistenceを使って実装してみる。
CQRS+ESをAkka Persistenceを使って実装してみる。CQRS+ESをAkka Persistenceを使って実装してみる。
CQRS+ESをAkka Persistenceを使って実装してみる。
Matsushita Satoshi
 
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
Johan Janssen
 
Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
Jerry Kuru
 
Arquitectura Lambda
Arquitectura LambdaArquitectura Lambda
Arquitectura Lambda
Israel Gaytan
 
DDDing Tools = Akka Persistence
DDDing Tools = Akka PersistenceDDDing Tools = Akka Persistence
DDDing Tools = Akka Persistence
Konrad Malawski
 
The Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneThe Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOne
Konrad Malawski
 
Akka http 2
Akka http 2Akka http 2
Akka http 2
Jean Detoeuf
 
Akka http
Akka httpAkka http
Akka http
Knoldus Inc.
 
Akka Persistence and Eventuate
Akka Persistence and EventuateAkka Persistence and Eventuate
Akka Persistence and Eventuate
Martin Krasser
 
spray: REST on Akka (Scala Days)
spray: REST on Akka (Scala Days)spray: REST on Akka (Scala Days)
spray: REST on Akka (Scala Days)
sirthias
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014
Konrad Malawski
 

Viewers also liked (20)

Event-sourced architectures with Akka
Event-sourced architectures with AkkaEvent-sourced architectures with Akka
Event-sourced architectures with Akka
 
scalaphx-akka-http
scalaphx-akka-httpscalaphx-akka-http
scalaphx-akka-http
 
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
Scala + Akka + ning/async-http-client - Vancouver Scala meetup February 2015
 
Akka persistence webinar
Akka persistence webinarAkka persistence webinar
Akka persistence webinar
 
Akka Persistence | Event Sourcing
Akka Persistence | Event SourcingAkka Persistence | Event Sourcing
Akka Persistence | Event Sourcing
 
Reactive programming with scala and akka
Reactive programming with scala and akkaReactive programming with scala and akka
Reactive programming with scala and akka
 
Akka Streams
Akka StreamsAkka Streams
Akka Streams
 
Event Sourcing using Akka on AWS
Event Sourcing using Akka on AWSEvent Sourcing using Akka on AWS
Event Sourcing using Akka on AWS
 
Akka-http
Akka-httpAkka-http
Akka-http
 
CQRS+ESをAkka Persistenceを使って実装してみる。
CQRS+ESをAkka Persistenceを使って実装してみる。CQRS+ESをAkka Persistenceを使って実装してみる。
CQRS+ESをAkka Persistenceを使って実装してみる。
 
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
JavaOne: A tour of (advanced) akka features in 60 minutes [con1706]
 
Akka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with ScalaAkka Http , Routes, Streams with Scala
Akka Http , Routes, Streams with Scala
 
Arquitectura Lambda
Arquitectura LambdaArquitectura Lambda
Arquitectura Lambda
 
DDDing Tools = Akka Persistence
DDDing Tools = Akka PersistenceDDDing Tools = Akka Persistence
DDDing Tools = Akka Persistence
 
The Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOneThe Cloud-natives are RESTless @ JavaOne
The Cloud-natives are RESTless @ JavaOne
 
Akka http 2
Akka http 2Akka http 2
Akka http 2
 
Akka http
Akka httpAkka http
Akka http
 
Akka Persistence and Eventuate
Akka Persistence and EventuateAkka Persistence and Eventuate
Akka Persistence and Eventuate
 
spray: REST on Akka (Scala Days)
spray: REST on Akka (Scala Days)spray: REST on Akka (Scala Days)
spray: REST on Akka (Scala Days)
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014
 

Similar to Codemotion akka persistence, cqrs%2 fes y otras siglas del montón

Estructurar y mantener aplicaciones Rails sin morir en el intento
Estructurar y mantener aplicaciones Rails sin morir en el intentoEstructurar y mantener aplicaciones Rails sin morir en el intento
Estructurar y mantener aplicaciones Rails sin morir en el intento
Moisés Maciá
 
Mongo db improve the performance of your application codemotion2016
Mongo db improve the performance of your application codemotion2016Mongo db improve the performance of your application codemotion2016
Mongo db improve the performance of your application codemotion2016
Juan Antonio Roy Couto
 
Codemotion 2015 - Akka voló sobre el nido del future
Codemotion 2015 - Akka voló sobre el nido del futureCodemotion 2015 - Akka voló sobre el nido del future
Codemotion 2015 - Akka voló sobre el nido del future
scalerablog
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
Chester Chen
 
How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...
Oleksandr Tarasenko
 
Scala for dummies
Scala for dummiesScala for dummies
Scala for dummies
Javier Santos Paniego
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Anton Kirillov
 
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Taro L. Saito
 
VSSML18. Introduction to WhizzML
VSSML18. Introduction to WhizzMLVSSML18. Introduction to WhizzML
VSSML18. Introduction to WhizzML
BigML, Inc
 
Using spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and CassandraUsing spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and Cassandra
Denis Dus
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data science
Sovello Hildebrand
 
Code-first GraphQL Server Development with Prisma
Code-first  GraphQL Server Development with PrismaCode-first  GraphQL Server Development with Prisma
Code-first GraphQL Server Development with Prisma
Nikolas Burk
 
Ch 7: Object-Oriented JavaScript
Ch 7: Object-Oriented JavaScriptCh 7: Object-Oriented JavaScript
Ch 7: Object-Oriented JavaScript
dcomfort6819
 
R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?
Villu Ruusmann
 
Spark Summit EU talk by Francois Garillot and Mohamed Kafsi
Spark Summit EU talk by Francois Garillot and Mohamed KafsiSpark Summit EU talk by Francois Garillot and Mohamed Kafsi
Spark Summit EU talk by Francois Garillot and Mohamed Kafsi
Spark Summit
 
Mobility insights at Swisscom - Understanding collective mobility in Switzerland
Mobility insights at Swisscom - Understanding collective mobility in SwitzerlandMobility insights at Swisscom - Understanding collective mobility in Switzerland
Mobility insights at Swisscom - Understanding collective mobility in Switzerland
François Garillot
 
Reactive app using actor model & apache spark
Reactive app using actor model & apache sparkReactive app using actor model & apache spark
Reactive app using actor model & apache spark
Rahul Kumar
 
Spark training-in-bangalore
Spark training-in-bangaloreSpark training-in-bangalore
Spark training-in-bangalore
Kelly Technologies
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?
Erik-Berndt Scheper
 
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessYour API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
QAware GmbH
 

Similar to Codemotion akka persistence, cqrs%2 fes y otras siglas del montón (20)

Estructurar y mantener aplicaciones Rails sin morir en el intento
Estructurar y mantener aplicaciones Rails sin morir en el intentoEstructurar y mantener aplicaciones Rails sin morir en el intento
Estructurar y mantener aplicaciones Rails sin morir en el intento
 
Mongo db improve the performance of your application codemotion2016
Mongo db improve the performance of your application codemotion2016Mongo db improve the performance of your application codemotion2016
Mongo db improve the performance of your application codemotion2016
 
Codemotion 2015 - Akka voló sobre el nido del future
Codemotion 2015 - Akka voló sobre el nido del futureCodemotion 2015 - Akka voló sobre el nido del future
Codemotion 2015 - Akka voló sobre el nido del future
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
 
How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...How to separate frontend from a highload python project with no problems - Py...
How to separate frontend from a highload python project with no problems - Py...
 
Scala for dummies
Scala for dummiesScala for dummies
Scala for dummies
 
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
Data processing platforms architectures with Spark, Mesos, Akka, Cassandra an...
 
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021Unifying Frontend and Backend Development with Scala - ScalaCon 2021
Unifying Frontend and Backend Development with Scala - ScalaCon 2021
 
VSSML18. Introduction to WhizzML
VSSML18. Introduction to WhizzMLVSSML18. Introduction to WhizzML
VSSML18. Introduction to WhizzML
 
Using spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and CassandraUsing spark 1.2 with Java 8 and Cassandra
Using spark 1.2 with Java 8 and Cassandra
 
R programming for data science
R programming for data scienceR programming for data science
R programming for data science
 
Code-first GraphQL Server Development with Prisma
Code-first  GraphQL Server Development with PrismaCode-first  GraphQL Server Development with Prisma
Code-first GraphQL Server Development with Prisma
 
Ch 7: Object-Oriented JavaScript
Ch 7: Object-Oriented JavaScriptCh 7: Object-Oriented JavaScript
Ch 7: Object-Oriented JavaScript
 
R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?R, Scikit-Learn and Apache Spark ML - What difference does it make?
R, Scikit-Learn and Apache Spark ML - What difference does it make?
 
Spark Summit EU talk by Francois Garillot and Mohamed Kafsi
Spark Summit EU talk by Francois Garillot and Mohamed KafsiSpark Summit EU talk by Francois Garillot and Mohamed Kafsi
Spark Summit EU talk by Francois Garillot and Mohamed Kafsi
 
Mobility insights at Swisscom - Understanding collective mobility in Switzerland
Mobility insights at Swisscom - Understanding collective mobility in SwitzerlandMobility insights at Swisscom - Understanding collective mobility in Switzerland
Mobility insights at Swisscom - Understanding collective mobility in Switzerland
 
Reactive app using actor model & apache spark
Reactive app using actor model & apache sparkReactive app using actor model & apache spark
Reactive app using actor model & apache spark
 
Spark training-in-bangalore
Spark training-in-bangaloreSpark training-in-bangalore
Spark training-in-bangalore
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?
 
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessYour API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
 

Recently uploaded

May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 

Recently uploaded (20)

May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 

Codemotion akka persistence, cqrs%2 fes y otras siglas del montón

  • 1. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence, CQRS/ES y otras siglas del montón Javier Santos
  • 2. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid About us Javier Santos @jpaniego «Hay dos formas de programar sin errores; sólo la tercera funciona» Alan J Perlis
  • 3. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalera.es @scalerablog About us
  • 4. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem to solve
  • 5. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem to solve
  • 6. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem to solve
  • 7. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid DDD - Domain Driven Design ● Context - The setting in which a word or statement appears that determines its meaning ● Domain (Ontology) - The subject area to which the user applies a program is the domain of the software ● Model - A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain ● Ubiquitous language - A language structured around the domain model and used by all team members to connect all the activities of the team with the software
  • 8. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid DDD - Domain Driven Design ● Context - The setting in which a word or statement appears that determines its meaning ● Domain (Ontology) - The subject area to which the user applies a program is the domain of the software ● Model - A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain ● Ubiquitous language - A language structured around the domain model and used by all team members to connect all the activities of the team with the software
  • 9. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid DDD - Domain Driven Design ● Context - The setting in which a word or statement appears that determines its meaning ● Domain (Ontology) - The subject area to which the user applies a program is the domain of the software ● Model - A system of abstractions that describes selected aspects of a domain and can be used to solve problems related to that domain ● Ubiquitous language - A language structured around the domain model and used by all team members to connect all the activities of the team with the software
  • 10. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Our domain model case class User( name: String, address: Address, credit: Double, currentBike: Option[Id[Bike]]) case class Bike( model: String, battery: Bike.Battery.Status, bikeStation: Option[Id[Station]]) case class Address( street: String, number: String, zipCode: String) case class Station( address: Address, maxBikeCapacity: Int, currentCapacity: Int)
  • 11. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Anemic Domain Model
  • 12. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Anemic Domain Model ● Think about a domain class that only contains fields and no methods. ● Anti-pattern against the main idea of the object-oriented programming paradigm: combining data and process together. ● Why not using C structs then? ¬¬
  • 13. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Anemic Domain Model case class User( name: String, address: Address, credit: Double, currentBike: Option[Id[Bike]]) { def startRental(bike: Id[Bike]): User = { require( currentBike.isEmpty,"There's another rental on course.") require( credit > 0, "Not enough credit to start a rental.") this.copy(currentBike = Some(bike)) } //...
  • 14. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Anemic Domain Model //... def finishRental(creditExpense: Double): User = { require( currentBike.isDefined, "There is not a rental on course.") this.copy( currentBike = None, credit = credit - creditExpense) } }
  • 15. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Aggregate ● Cluster of domain objects ● The whole block of domain objects works as a sole entity. User Bike Address
  • 16. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Aggregate trait Aggregate extends ...{ def id: Id[This] } case class Station( address: Address, maxBikeCapacity: Int, currentCapacity: Int)
  • 17. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Event Sourcing ● “Every change to the state of an application is captured in an event object, and that these event objects are themselves stored in the sequence they were applied for the same lifetime as the application state itself” - Martin Fowler
  • 18. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Event Sourcing ● The system state is the sum of the events
  • 19. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Stateful[T] trait Stateful[S] { type This <: Stateful[S] type Action = scalaz.State[S, Event] val state: S def apply(s: S): This def update(f: Action): (This, E) = { val (newState, e) = f(state) (apply(newState), e) } }
  • 20. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalaz.State
  • 21. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalaz.State ● Represents a state mutation that may generate some effect. ● type State[S, Effect] = StateT[Id, S, Effect] ● Monad = composable!
  • 22. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalaz.State type Action[E] = scalaz.State[User, E] def addCredit(amount: Double): Action[Double] = State(user => (user.copy(credit = user.credit + amount), amount)) def rentBike(bike: Id[Bike], timesUsed: Long): Action[Long] = State(user => (user.copy(currentBike = Some(bike), timesUsed + 1))
  • 23. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalaz.State val topUpAndRent: Action[(Double, Long)] = for { newCredit <- addCredit(10) timesUsed <- rentBike(Id(“bike-1”)) } yield (newCredit, timesUsed) val (relaxingAnn, (newCredit, bikeAge)) = topUpAndRent(User(“Ann Bottle”, Addres(...), 0.0, None)
  • 24. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Immutability perversion
  • 25. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid StatefulAgg[T] trait StateAgg[S] extends Stateful[S]{ _: PersistenActor => var aggState: S def updateState(f: Action): Unit = { val (newAgg, _) = update(f) aggState = newAgg.state } }
  • 26. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid StatefulAgg[T] trait StateAgg[S] extends Stateful[S]{ _: PersistenActor => var aggState: S def updateState(f: Action): Unit = { val (newAgg, _) = update(f) aggState = newAgg.state } }
  • 27. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid
  • 28. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid CQRS ● Command Query Responsibility Segregation ● Main idea: “You can use a different model to update the information than the model you use to read information”
  • 29. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid CQRS
  • 30. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid CQRS trait Command[Agg] { val to: Id[Agg] } trait Event
  • 31. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence ● End of 2013 ● Martin Krasser ● Main idea : store the internal state of an actor ● ...BUT not directly, only through the changes the actor has suffered.
  • 32. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence
  • 33. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence
  • 34. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence - Failure recovery
  • 35. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence - Failure recovery
  • 36. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence - Failure recovery
  • 37. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence - Failure recovery
  • 38. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Snapshotting
  • 39. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Snapshotting
  • 40. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Persistent actors trait PersistenceStuff extends PersistentActor{ def persistenceId: String def receiveCommand: Receive def receiveRecover: Receive }
  • 41. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid trait Reactive { _: Stateful[S] => val onEvent: Event => Action val onSnapshot: Any => Action = { case snapshot => State(s => (s, snapshot)) } def asEvent(c: Command[This]): Event } Persistent actors
  • 42. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid trait Aggregate[S] extends StateAgg[S] with Reactive with PersistentActor { def persistenceId: String = id.id def receiveRecover: Receive = { case event: Event => update(onEvent(event)) case snapshot => update(onSnapshot(snapshot)) } def receiveCommand: Receive = { case cmd: Command[This@unchecked] => if (checkState(cmd)) persistAll(List(asEvent(cmd))){ event => update(onEvent(event)) sender ! event } else sender ! Nope } } Persistent actors
  • 43. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid case class UserAgg(state: User.Default) extends Aggregate[User] { type This = UserAgg def apply(s: User) = UserAgg(s) override val onEvent = { case e@AddedCredit(amount) => State(s => (s.copy(credit = s.credit+10),e)) } def asEvent(c: Command[This]): Event = c match { case AddCredit(_, amount) => AddedCredit(amount) } } Persistent actors boilerplate
  • 44. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Persistence Queries ● Like a PersistentActor but with no Command part ● peristenceId subscription or by tag ● refreshInterval in most plugins
  • 45. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Persistence Queries val readJournal = PersistenceQuery(system).readJournalFor[MyScaladslReadJournal]( "akka.persistence.query.my-read-journal") // issue query to journal val source: Source[EventEnvelope, NotUsed] = readJournal.eventsByPersistenceId("user-1337") // materialize stream, consuming events implicit val mat = ActorMaterializer() source.runForeach { event => println("Event: " + event) }
  • 46. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid getOrCreate ● A new command is launched against user1...how to deliver it? ● Managers class UserManager extends Actor { override def receive = { case cmd: Command[User@unchecked] => getOrCreate(cmd.addresse) forward cmd } }
  • 47. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid getOrCreate ● Imagine there are 500k registered users … ● ...you create a persistent actor and deliver the just arrived command… ● ...the actor keeps alive….
  • 48. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid getOrCreate
  • 49. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Passivation ● Kill the actor if it’s iddle… trait Passivation extends PersistentActor { import ShardRegion.Passivate context.setReceiveTimeout(60.seconds) override def receiveCommand = { //… case ReceiveTimeout => context.parent ! Passivate(stopMessage = Stop) } }
  • 50. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid
  • 51. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Journal ● Different supported pluggable storages: ○ AndroidSQLite ○ BDB ○ Cassandra ○ Kafka ○ DynamoDB ○ HBase ○ MongoDB ○ … ● Why choosing a distributed database as Journal for High Availability?
  • 52. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid HA : Clustering
  • 53. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid HA : Clustering ● Send semantics ○ Send: The message is sent to an only cluster actor that fits in the path. If several, the actor is chosen randomly. clusterClient ! Send(«/user/handler», «hello», localAffinity = true) ○ SendToAll: The message is sent to all cluster actors that fit in the path. clusterClient ! SendToAll(«/user/handler», «hi») ○ Publish: The message is sent to all topic subscribers clusterClient ! Publish(«myTopic», «hello»)
  • 54. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Partitioning : Sharding ● Study case: ○ A command is sent (in a cluster) to aggregate1, the actor is created in node1, the command is processed. ○ A second command is sent (in the same cluster) to aggregate1, but this time the command is received by node2, so the actor is created there.
  • 55. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Partitioning : Sharding ● It provides ○ Load balancing: In case a new is added to the cluster or another one crashes, the total actor amount is balanced. ○ Unique actor identification, so messages that are sent to the same actor will be forwarded to the node that handles in that moment that shard id (previous case won’t take place)
  • 56. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Partitioning : Sharding ● Semantics ○ Entry: It represents a uniquely identified entity with persistent state (Aggregate). ○ Shard: Entry group. Experts recommend ShardAmount = 10 x MaxNodeAmount ○ ShardRegion: Same Entry shard group.
  • 57. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Partitioning : Sharding
  • 58. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid #graciasCarmena #llevameEnTuBiciceta
  • 59. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: eventual consistency ● Changes may take some time ● If the user requires an immediate update, user views could be updated when the command part has acknowledge the event persistence (handle it carefully...)
  • 60. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: Distributed transactions ● Let’s suppose credit transfer is allowed among users ● Saga Pattern: A persistent actor that represents a transaction among aggregates
  • 61. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: Distributed transactions
  • 62. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: cluster initialization
  • 63. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: cluster initialization
  • 64. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: cluster initialization
  • 65. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: cluster initialization
  • 66. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: Testing a PersistentActor TestActorRef + PersistentActor =
  • 67. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem: Testing a PersistentActor TestActorRef + PersistentActor =
  • 68. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Problem : Schema evolution ● Imagine the following: case class User(name: String, address: Address, amount: Double) case class User(cardId: String, amount: Double, usualBike: Bike) ● Choosing proper serializers are the key (ProtoBuf, Avro, Java ser...no way) ● Event migration (EventAdapter) ● How to: ○ add attribute ○ remove attribute ○ rename attribute ○ ...
  • 69. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Lightbend approach ● Runs on JRE 1.8 ● Multiple service control ● Event stream abstraction ● Easy scalability ● Java SDK ...
  • 70. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Lightbend approach ● Runs on JRE 1.8 ● Multiple service control ● Event stream abstraction ● Easy scalability ● Java SDK ...
  • 71. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid scalera.es @scalerablog
  • 72. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid
  • 73. MADRID · NOV 18-19 · 2016 Scala Programming @ Madrid Akka persistence, CQRS/ES y otras siglas del montón Javier Santos