akka.net: how to remotely deploy actors
TRANSCRIPT
@petabridge Petabridge.com
Akka.NET: Deploying Actors over the Network
By Aaron StannardCTO, Petabridge
@petabridge Petabridge.com
Akka.NET's Extensibility Model
@petabridge Petabridge.com
Akka.Remote Brings the Network to Akka.NET
@petabridge Petabridge.com
Akka.Remote Capabilities
Akka.RemoteCapabilities
Communicate withactors on remote
systems
Deploy actors ONTOremote systems
Configure and supportmultiple network
transports
@petabridge Petabridge.com
How to Enable Akka.Remote
InstallAkka.RemoteNuGet package
ConfigureRemoteActorRef
Provider
Enable at least 1transport
Configure address foreach transport
StartActorSystem
@petabridge Petabridge.com
Sample Configuration
akka {actor.provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
remote {helios.tcp {port = 8081
hostname = localhost } }}
akka {actor.provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
remote {helios.tcp {port = 0
hostname = localhost } }}
Server
Client
@petabridge Petabridge.com
Local Address
akka://MySystem/user/myActor1/myActor2
Protocol
ActorSystem Path
All parts form an "ActorPath"
@petabridge Petabridge.com
Remote Address
akka.tcp://MySystem@localhost:9001/user/actorName1
Protocol
ActorSystem
Address
Path
All parts form an "ActorPath"
@petabridge Petabridge.com
Akka.Remote Associations
1. "Hey, let's do some stuff together"
2. "Yes, let's do that!"
@petabridge Petabridge.com
Two Ways to Initiate a Remote Connection
• Remote ActorSelection• Remote Deployment
@petabridge Petabridge.com
Remotely Deploying Actors
@petabridge Petabridge.com
"Deploying" an Actor
• Creating an actor instance with configured properties
• akka.actor.deployment
• Getting an IActorRef to actor
@petabridge Petabridge.com
Location of Actor on Network is a Deployment
Detail
@petabridge Petabridge.com
Remote Deployment
1. "Create aFooActorfor me"
FooActor
2. "Sure thing, here it is!"
@petabridge Petabridge.com
Remote Actor Deployment
CODE SAMPLE
@petabridge Petabridge.com
How Remote Deployment Actually Works
Deployer (ActorRefProvider)akka.tcp://Deployer@localhost:{random}
DeployTarget (ActorRefProvider)akka.tcp://DeployTarget@localhost:8090
EndpointWriter
EndpointReader
1. Deploy Props<EchoActor>"echoactor" ontoDeployTarget
RemoteActorRef(maps toActorRef on
DeployTarget)
2. CreateRemoteActorReffor "echoactor"
3. Serialize Propsand deploy info
4. Transmit
5.DeserializeProps and deploy info
EchoActor(Remote)
6. Create Actor
7. Delivers messagesover network toactual actor instance
@petabridge Petabridge.com
Important Things to Know about Remote Deployment
Remote ActorDeployments
Remote actor names determinedby deploying system
Actor and message types must bepresent on bothdeployer and
deployee
All constructor arguments forremote-deployed actors must be
serializable
@petabridge Petabridge.com
Akka.NET Training
Intro to Akka.NET http://learnakka.net/
Advanced Akka.NEThttps
://petabridge.com/training/