我正在创建一个Akka.Cluster
包含三个节点 A、B 和 C 的示例,其中 A 是灯塔。到目前为止,从日志来看,当没有演员或演员是本地的(使用spawn
and创建spawnOpt
)时,集群可以正常工作。我想从 B 创建一个演员并从 C 访问它。
和
let _ = spawne system "r-actor" <@ actorOf (fun msg -> printfn "Received: %s" msg) @> []
我明白了
2016-08-31 01:59:00.1185|INFO|Akka.Actor.EmptyLocalActorRef|Message String from akka://calculatorSystem/deadLetters to akka://calculatorSystem/user/r-actor was not delivered. 1 dead letters encountered.
使用
let r = FromConfig.Instance :> RouterConfig |> SpawnOption.Router
let _ = spawne system "r-actor" <@ actorOf (fun msg -> printfn "Received: %s" msg) @> [r]
抛出异常
Akka.Configuration.ConfigurationException
Akka.dll 中发生未处理的类型异常
附加信息:Configuration problem while creating [akka://calculatorSystem/user/r-actor] with router dispatcher [akka.actor.default-dispatcher] and mailbox and routee dispatcher [akka.actor.default-dispatcher] and mailbox [].
节点 C 上的测试函数为
let rec calculate content =
printfn "Processing %s" content
let actor = select "/user/r-actor" system
actor <! content
let text = Console.ReadLine()
if text <> "quit" then
calculate text
calculate "sample1"
HOCON(节点 B)
akka {
actor {
provider = "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
serializers {
wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
}
serialization-bindings {
"System.Object" = wire
}
deployment {
/user/add {
router = round-robin-pool
nr-of-instances = 10
cluster {
enabled = on
max-nr-of-instances-per-node = 10
allow-local-routees = off
}
}
/user/r-actor {
router = round-robin-pool
nr-of-instances = 10
cluster {
enabled = on
max-nr-of-instances-per-node = 10
allow-local-routees = off
}
}
}
}
remote {
log-remote-lifecycle-events = DEBUG
log-received-messages = on
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
hostname = "127.0.0.1"
port = 0
}
}
loggers = ["Akka.Logger.NLog.NLogLogger,Akka.Logger.NLog"]
cluster {
seed-nodes = [
"akka.tcp://calculatorSystem@127.0.0.1:7001"
]
roles = ["add-service"]
auto-down-unreachable-after = 10s
}
}
如何创建可由集群中的另一个节点调用的参与者?