![Page 1: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/1.jpg)
Akka 2.4.x and
Commercial Features1 September 2015
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 2: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/2.jpg)
Konrad `ktoso` Malawski
Akka Team,Reactive Streams TCK
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 3: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/3.jpg)
Reactive Platform: Akka
• Reactive Platform: Versioning explained• Remoting / Cluster: Docker networking support• Cluster: Split Brain Resolver (beta)• Akka Persistence: Cross-Scala-version snapshot deserializer• Java 6: Extended LTS
• Akka 2.4.x (currently in Release Candidate phase)• Cluster Tools promoted to stable!• Persistence promoted to stable!• Persistence Queries (experimental)• Akka Typed (experimental)• Distributed Data (experimental)• Akka Streams (currently 1.0, will be included in 2.4.x eventually)
• Q / AAkka 2.4 and RP commercial features
with Konrad `@ktosopl` Malawski
![Page 4: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/4.jpg)
Reactive Platform
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 5: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/5.jpg)
Reactive Platform
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
https://together.typesafe.com/products/reactivePlatform
![Page 6: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/6.jpg)
Reactive Platform Versioning
15v05p01
year
month
patch=
Scala 2.10.xAkka 2.3.x …
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
https://together.typesafe.com/products/reactivePlatform
![Page 7: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/7.jpg)
Reactive Platform Versioning
https://together.typesafe.com/products/reactivePlatform
15v05p01
year
month
patch=
Scala 2.10.xAkka 2.3.x …
15v09p01 =
Scala 2.11.xAkka 2.3.12 => 2.3.++ (binary compatible!) …
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 8: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/8.jpg)
Reactive Platform Versioning
https://together.typesafe.com/products/reactivePlatform
How does this help?• Huge integration test suite before release• Certified to work well together• Priority updates / additional features• Back-ports, fixes, long-term support
Life cycle of each release: 2 years
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 9: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/9.jpg)
NAT Support
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 10: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/10.jpg)
support(NAT support)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 11: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/11.jpg)
support(NAT support)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Available in: RP 15v01p## (Akka 2.3.x), OSS only in Akka 2.4.x (work in progress)
![Page 12: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/12.jpg)
Docker / NAT support
docker run -d -p 8000:2551 akka-app
Akka App
172.17.0.11:2551
Outside world
example.com:8000
doc.akka.io/docs/akka/2.4.0-RC1/general/remoting.html#Peer-to-Peer_vs__Client-Server
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 13: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/13.jpg)
Docker / NAT support
akka.remote { netty.tcp { hostname = example.com # external (logical) hostname port = 8000 # external (logical) port
bind-hostname = 172.17.0.11 # internal (bind) hostname bind-port = 2552 # internal (bind) port }}
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
doc.akka.io/docs/akka/2.4.0-RC1/general/remoting.html#Peer-to-Peer_vs__Client-Server
![Page 14: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/14.jpg)
Split Brain Resolver
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 15: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/15.jpg)
Split Brain Resolver (customer beta)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Installing the Reactive Platform with Split Brain Resolver
![Page 16: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/16.jpg)
Split Brain Resolver
• Fundamental Problem in all distributed systems• SBR helps to make decisions, is not a magic wand
• A set of pre-built strategies for when to down nodes in a cluster.
• Strategies:• Static Quorum (like zoo-keeper)• Keep Majority• Keep Oldest• Keep Referee
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
http://doc.akka.io/docs/akka/rp-15v09p01/scala/split-brain-resolver.html
![Page 17: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/17.jpg)
Split Brain Resolver
• The default behaviour of Akka Cluster is “Manual Downing”:• A node needs to issue cluster.down(address)• This decision can be powered by external
monitoring,or DevOps teams observing the cluster.
• It is Safe.however involves the most human/automated work
• A naive implementation exists called “auto-downing”• It is not very safe to be used in real clusters• Definitely not a good choice for apps using
Persistence• It is not recommended for production deployments.Akka 2.4 and RP commercial features
with Konrad `@ktosopl` Malawski
http://doc.akka.io/docs/akka/rp-15v09p01/scala/split-brain-resolver.html
![Page 18: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/18.jpg)
Heartbeats
A
heartbeats
heartbeats
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 19: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/19.jpg)
Heartbeats
A
heartbeats
heartbeats
everyone is down!
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 20: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/20.jpg)
Heartbeats
A
`n-1` is down!I’ll take over `A`!
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 21: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/21.jpg)
Heartbeats
A
`n-1` is down!I’ll take over `A`!
A
good if: n-1 really is down.bad: if n-1 is just very unresponsive
Fundamentally, it is hard to distinguish the two states in distributed systems.
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 22: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/22.jpg)
Static Quorum (3 (> (n/2 +1))
A
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 23: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/23.jpg)
Static Quorum (3 (> (n/2 +1))
we need to down ourselves
A
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 24: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/24.jpg)
Keep Majority (aka. dynamic quorum)
A
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 25: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/25.jpg)
Keep Majority (aka. dynamic quorum)
A
we need to down ourselves
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 26: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/26.jpg)
referee node
Keep Referee
A
down-all-if-less-than-nodes
![Page 27: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/27.jpg)
referee node
Keep Referee
A
can’t see referee node!
down-all-if-less-than-nodes
![Page 28: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/28.jpg)
oldest node
Keep Oldest
A
can’t see oldest node!
down-if-alone
oldest node can change,if “up until now oldest node” leaves the
cluster.This is more dynamic than keep-
referee.
![Page 29: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/29.jpg)
PersistenceCross-scala-versioncompatibility for snapshots
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 30: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/30.jpg)
Persistence: Cross-scala-version compat
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Enhanced compatibility for persistent snapshot envelope.(Payload compatibility depends on application.)
![Page 31: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/31.jpg)
Persistence: Cross-scala-version compat
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Enhanced compatibility for persistent snapshot envelope.(Payload compatibility depends on application.)
• Scala 2.10 is not binary compatible with 2.11• 10 => 11 is “major update” by design
![Page 32: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/32.jpg)
Persistence: Cross-scala-version compat
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Enhanced compatibility for persistent snapshot envelope.(Payload compatibility depends on application.)
• More compatible deserialisation than the language itself!
• Eases migration to latest Scala versions
• (Your journal may actually not be affected and be compatible anyway.)
• Scala 2.10 is not binary compatible with 2.11• 10 => 11 is “major update” by design
![Page 33: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/33.jpg)
Persistence: Cross-scala-version compat
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
saveSnapshot( )
Akka 2.3 + Scala 2.10
![Page 34: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/34.jpg)
Persistence: Cross-scala-version compat
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
saveSnapshot( )
Akka 2.3 + Scala 2.10
Akka 2.3 + Scala 2.11
loadSnapshotsmart serializer
![Page 35: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/35.jpg)
Java 6 Extended LTS
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 36: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/36.jpg)
Java 6: Extended LTS
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
• Existing RP releases keep Java 1.6 compatibility
![Page 37: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/37.jpg)
Java 6: Extended LTS
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
• Existing RP releases keep Java 1.6 compatibility
• Akka Streams & Http currently work with 1.6• will be merged into Akka 2.4 (likely after 1.1)• we can back-port and support for RP (Akka 2.3)
![Page 38: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/38.jpg)
Java 6: Extended LTS
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
• Existing RP releases keep Java 1.6 compatibility
• Akka Streams & Http currently work with 1.6• will be merged into Akka 2.4 (likely after 1.1)• we can back-port and support for RP (Akka 2.3)
• Akka 2.4 does require Java 8• Scala 2.11 + Scala 2.12 (once released)• it will enter RP once released
![Page 39: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/39.jpg)
Akka 2.4
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 40: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/40.jpg)
Akka 2.4
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
• 2.3 => 2.4 is a major update• additional effort made it binary compatible!• it does require Java 1.8
• i.e. update your JDK, same sources “just work”
• Future:• Version bump to 3.0 if binary incompatible
![Page 41: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/41.jpg)
Cluster Tools
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Now Stable!
![Page 42: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/42.jpg)
Akka 2.4 Cluster Tools (Now Stable!)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
• Distributed Pub Sub• Smart message batching (1 send per node)
• Cluster Singleton• useful for “master” or coordinator Actors
• Cluster Sharding• useful for sharding load onto the cluster• graceful shut-down• balancing load across cluster
![Page 43: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/43.jpg)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-pub-sub.html
class Subscriber extends Actor with ActorLogging {
import DistributedPubSubMediator.{ Subscribe, SubscribeAck } val mediator = DistributedPubSub(context.system).mediator // subscribe to the topic named "content" mediator ! Subscribe("content", self) def receive = { case SubscribeAck(Subscribe("content", None, `self`)) ⇒ context become ready } def ready: Actor.Receive = { case s: String ⇒ log.info("Got {}", s) }}
Akka 2.4 Cluster Tools - PubSub (Now Stable!)
![Page 44: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/44.jpg)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
class Publisher extends Actor { import DistributedPubSubMediator.Publish // activate the extension val mediator = DistributedPubSub(context.system).mediator def receive = { case in: String ⇒ val out = in.toUpperCase mediator ! Publish("content", out) }}
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-pub-sub.html
Akka 2.4 Cluster Tools - PubSub (Now Stable!)
![Page 45: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/45.jpg)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
AB
C D
http://doc.akka.io/docs/akka/2.4.0-RC1/scala/cluster-singleton.html
Akka 2.4 Cluster Tools - Cluster Singleton (Now Stable!)
![Page 46: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/46.jpg)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
A
B
C
D
role: backend-2 role: backend-2
http://doc.akka.io/docs/akka/2.4.0-RC1/scala/cluster-singleton.html
Akka 2.4 Cluster Tools - Cluster Singleton (Now Stable!)
![Page 47: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/47.jpg)
Akka 2.4 Cluster Tools - Sharding (Now Stable!)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
A B
C D
doc.akka.io/docs/akka/2.4.0-RC1/scala/cluster-sharding.html
![Page 48: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/48.jpg)
Akka 2.4 Cluster Tools - Sharding (Now Stable!)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
val counterRegion: ActorRef = ClusterSharding(system).start( typeName = "Counter", entityProps = Props[Counter], settings = ClusterShardingSettings(system), extractEntityId = extractEntityId, extractShardId = extractShardId)
val counterRegion: ActorRef = ClusterSharding(system).shardRegion("Counter")counterRegion ! Get(123)expectMsg(0)
Start a shard region:
Other nodes in cluster send messages to it:
doc.akka.io/docs/akka/2.4.0-RC1/scala/cluster-sharding.html
![Page 49: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/49.jpg)
Persistence
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Now Stable!
![Page 50: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/50.jpg)
var state = S0
persistenceId = “a”
Command
Journal
Akka 2.4 Persistence (Now Stable!)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 51: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/51.jpg)
var state = S0
persistenceId = “a”
Journal
Generate Events
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 52: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/52.jpg)
var state = S0
persistenceId = “a”
Journal
Generate Events
E1
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 53: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/53.jpg)
ACK “persisted”
Journal
E1
var state = S0
persistenceId = “a”
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 54: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/54.jpg)
“Apply” event
Journal
E1
var state = S0
persistenceId = “a”
E1
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 55: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/55.jpg)
Journal
E1
var state = S0
persistenceId = “a”
E1Okey!
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 56: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/56.jpg)
Journal
E1
var state = S0
persistenceId = “a”
E1Okey!
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 57: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/57.jpg)
Journal
E1
var state = S0
persistenceId = “a”
E1
Ok, he got my $.
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 58: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/58.jpg)
…sum of states…
Journal
E1 E2 E3 E4
E5 E6 E7 E8
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 59: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/59.jpg)
Snapshot Store
snapshot!
state until [E5]
S5Journal
E1 E2 E3 E4
E5 E6 E7 E8
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 60: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/60.jpg)
Snapshot Store
state until [E8]
S8Journal
E1 E2 E3 E4
E5 E6 E7 E8
S5
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 61: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/61.jpg)
state until [E8]
S8
Snapshot Store
Journal
E1 E2 E3 E4
E5 E6 E7 E8
crash!
S5
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 62: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/62.jpg)
Snapshot Store
Journal
E1 E2 E3 E4
E5 E6 E7 E8
crash!
S5
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 63: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/63.jpg)
“bring me up-to-date!”
Snapshot Store
Journal
E1 E2 E3 E4
E5 E6 E7 E8
restart!
replay!
S5
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 64: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/64.jpg)
“bring me up-to-date!”
Snapshot Store
restart!
replay!
S5Journal
E1 E2 E3 E4
E5 E6 E7 E8
S5
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 65: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/65.jpg)
state until [E8]
Snapshot Store
S5
restart!
replay!
S8Journal
E1 E2 E3 E4
E5 E6 E7 E8
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka 2.4 Persistence (Now Stable!)
![Page 66: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/66.jpg)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Advanced support for long-term schema evolution.
EventAdapters & StringManifestSerializers
Akka 2.4 Persistence (Now Stable!)
![Page 67: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/67.jpg)
Persistence Query
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
New module, experimental!
![Page 68: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/68.jpg)
Akka 2.4 Persistence Queries (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
API still work in progress, should be polished very soon.
val query: Source[RichEvent, QueryStats] = readJournal.query(ByTagsWithStats(Set("red", "blue")))
query .map { event => s"Event payload: ${event.payload}" } .runWith(Sink.ignore)
![Page 69: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/69.jpg)
Akka 2.4 Persistence Queries (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
API still work in progress, should be polished very soon.
val query: Source[RichEvent, QueryStats] = readJournal.query(ByTagsWithStats(Set("red", "blue")))
query .map { event => s"Event payload: ${event.payload}" } .runWith(Sink.ignore)
Journalwrite-side
query-side
QueryOptimised
Journal
query-side
Simple view / result
![Page 70: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/70.jpg)
Akka Typed
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
New module, experimental!
![Page 71: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/71.jpg)
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor
Akka 2.4 Typed (experimental)
![Page 72: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/72.jpg)
Akka 2.4 Typed (experimental)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
![Page 73: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/73.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
The main concept is Behaviour[T]Explicit protocols for the win!
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 74: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/74.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
Since Behaviour[Greet] is typed,
msg is-a Greet.
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 75: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/75.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
The Behaviour[T]is the receive.
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 76: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/76.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
sender() is no more.Explicit protocols for the win!
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 77: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/77.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
sender() is no more.Explicit protocols for the win!
final case class Greet(whom: String, replyTo: ActorRef[Greeted])
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 78: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/78.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
ActorRef[T] is now typed!
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 79: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/79.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom)
}
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
become()is required.
And replaced by returning the “next” Behaviour[T]
// context.become(receive)
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 80: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/80.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom)
}
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
become()is required.
And replaced by returning the “next” Behaviour[T]On a conceptual level at least,
we provide Static[T]if you don’t need become.
// context.become(receive)
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 81: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/81.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom)
}
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
become()is required.
And replaced by returning the “next” Behaviour[T]Special behaviors:
Same / Unhandled / Empty / Stopped / Ignore
// context.become(receive)
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 82: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/82.jpg)
val greeter = Total[Greet] { msg ⇒
println(s"Hello ${msg.whom}!") msg.replyTo ! Greeted(msg.whom)
Same}
val system: ActorSystem[Greet] = ActorSystem(“typed", Props(totalGreeter))
system ! Greet("kapi", system.deadLetters)
class Greeter extends Actor {
def receive = { case msg: Greet ⇒ println(s"Hello ${msg.whom}!") sender() ! Greeted(msg.whom) }
}
val system: ActorSystem = ActorSystem(“akka-actor-system“)
val greeter = system.actorOf(Props[Greeter])
system ! Greet("kapi", system.deadLetters)
Akka Actor Akka Typed
“Root actor” is not user-defined for ActorSystem[T]
Encourages thinking about supervision.
doc.akka.io/docs/akka/2.4.0-RC1/scala/typed-actors.html
Akka 2.4 Typed (experimental)
![Page 83: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/83.jpg)
Akka Distributed Data
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
New module, experimental!
![Page 84: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/84.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
for “small, fast data”
Implements various CRDTs and gossips changes through the Cluster.
CRDTs = Conflict-free Replicated Data TypesData structures that can be concurrently updatedand always eventually converge on the same value.
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 85: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/85.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
for “small, fast data”
Implements various CRDTs and gossips changes through the Cluster.
CRDTs = Conflict-free Replicated Data TypesData structures that can be concurrently updatedand always eventually converge on the same value.
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 86: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/86.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
value = 5n1: 2n2: 0n3: 3 Akka Cluster (gossip)
GCounter example:
value = 5n1: 2n2: 0n3: 3
value = 5n1: 2n2: 0n3: 3
node-1 node-2
node-3
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 87: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/87.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
value = 6n1: 2+1n2: 0n3: 3 Akka Cluster (gossip)
GCounter example:
value = 5n1: 2n2: 0n3: 3
value = 6n1: 2n2: 0n3: 3+1
node-1 node-2
node-3
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 88: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/88.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
node-1 node-2
node-3
value = 7n1: 2+1n2: 0
n3: 3+1 Akka Cluster (gossip)
GCounter example:
value = 5n1: 2n2: 0n3: 3
value = 6n1: 2n2: 0n3: 3+1
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 89: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/89.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
node-1 node-2
node-3
value = 7n1: 2+1n2: 0
n3: 3+1 Akka Cluster (gossip)
GCounter example:
value = 7n1: 2+1n2: 0
n3: 3+1
value = 7n1: 2+1n2: 0n3: 3+1
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 90: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/90.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
implicit val node = Cluster(system)val replicator = DistributedData(system).replicator val Counter1Key = PNCounterKey("counter1")
replicator ! Update(Counter1Key, PNCounter(), WriteLocal)(_ + 1)
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 91: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/91.jpg)
Akka 2.4 Distributed Data (experimental)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Provided data types:• Counters: GCounter, PNCounter• Sets: GSet, ORSet• Maps: ORMap, ORMultiMap, LWWMap, PNCounterMap• Registers: LWWRegister, Flag
doc.akka.io/docs/akka/2.4.0-RC1/scala/distributed-data.html
![Page 92: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/92.jpg)
Akka Streams & Http
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
1.0 (experimental) currently.will join the Akka 2.4.x release.
![Page 93: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/93.jpg)
Akka Streams & Http (experimental, to eventually join Akka 2.4.x)
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
Akka StreamsAsynchronous Back-pressured Stream ProcessingAn implementation of Reactive Streams.
Reactive Streamsan initiative co-lead by Typesafe, Netflix, Pivotal, RedHat),allowing for inter-op of asynchronous streaming libraries.
Akka Http Superseeds Spray.io, the well known high-performance Http serverFully based on Akka Streams.
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala.html
![Page 94: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/94.jpg)
http://www.reactive-streams.org/
Reactive Streams (1.0, en route to be included in JDK9)
![Page 95: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/95.jpg)
Akka Streams <-> Actors – Advanced
val subscriber = ActorSubscriber( system.actorOf(Props[SubStreamParent], ”parent”))
Source(1 to 100) .map(_.toString) .filter(_.length == 2) .drop(2) .conflate(seed => seed)((acc, i) => acc + i) .groupBy(_.last) .runWith(subscriber)
All the usual ops available for Linear Flows.
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala.html
![Page 96: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/96.jpg)
Links• akka.io• reactive-streams.org• akka-user• https://www.typesafe.com/subscription
• Streams and Http• http://doc.akka.io/docs/akka-stream-and-http-exp
erimental/1.0/scala.html• http://doc.akka.io/docs/akka-stream-and-http-exp
erimental/1.0/java.html
• Akka 2.4 RC1• http://doc.akka.io/docs/akka/2.4.0-RC1/scala.html• http://doc.akka.io/docs/akka/2.4.0-RC1/java.html
Akka 2.4 and RP commercial featureswith Konrad `@ktosopl` Malawski
![Page 97: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/97.jpg)
Perhaps you’d also like…
WEBINAR
Introducing Typesafe ConductR
WATCH NOW
HAVE QUESTIONS?
Get in touch with Typesafe today!
CONTACT US
ACTIVATOR TEMPLATE
Akka Distributed Data Samples (Scala)
CHECK IT OUT
![Page 98: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/98.jpg)
EXPERT TRAININGDelivered on-site for Akka, Spark, Scala and Play
Help is just a click away. Get in touch with Typesafe about our training courses.
• Intro Workshop to Apache Spark • Fast Track & Advanced Scala• Fast Track to Akka with Java or Scala• Fast Track to Play with Java or Scala• Advanced Akka with Java or Scala
Ask us about local trainings available by 24 Typesafe partners in 14 countries around the world.
CONTACT US Learn more about on-site training
![Page 99: Akka 2.4 plus commercial features in Typesafe Reactive Platform](https://reader031.vdocument.in/reader031/viewer/2022030123/58a4e1b11a28ab34318b6c09/html5/thumbnails/99.jpg)
©Typesafe 2015 – All Rights Reserved
K
©Typesafe 2015 – All Rights Reserved