Skip to content

Instantly share code, notes, and snippets.

@pmbanka
Last active February 12, 2018 16:20
Show Gist options
  • Save pmbanka/094d4ee0c7c384b4eb045c5eb86c5ebf to your computer and use it in GitHub Desktop.
Save pmbanka/094d4ee0c7c384b4eb045c5eb86c5ebf to your computer and use it in GitHub Desktop.
Akka.Path serialization examples
#load @"../.paket/load/net452/main.group.fsx"
open System
open Akka.Actor
open Akkling
let config =
"""
akka {
actor {
provider = remote
}
remote {
dot-netty.tcp {
port = 8080
hostname = localhost
}
}
}
"""
|> Configuration.parse
let system = System.create "Test" config
let a : IActorRef<obj> = spawn system "foobarbaz" (props Behaviors.ignore)
a.ToString()
// val it : string = "[akka://Test/user/foobarbaz#370630237]"
a.Path.ToString()
// val it : string = "akka://Test/user/foobarbaz"
a.Path.ToSerializationFormat()
// val it : string = "akka://Test/user/foobarbaz#370630237"
let address = (system :?> ExtendedActorSystem).Provider.DefaultAddress
a.Path.ToSerializationFormatWithAddress address
// val it : string = "akka.tcp://Test@localhost:8080/user/foobarbaz#851817992"
a.Path.ToStringWithAddress()
// val it : string = "akka://Test/user/foobarbaz"
a.Path.ToStringWithoutAddress()
// val it : string = "/user/foobarbaz"
a.Path.ToStringWithUid()
// val it : string = "akka://Test/user/foobarbaz#634000283"
a.Path.Name
// val it : string = "foobarbaz"
a.Path.Address.ToString()
// val it : string = "akka://Test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment