首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >正在删除非本地收件人的邮件[Akka.Actor.ActorSelectionMessage]

正在删除非本地收件人的邮件[Akka.Actor.ActorSelectionMessage]
EN

Stack Overflow用户
提问于 2020-09-26 03:41:25
回答 1查看 233关注 0票数 1

我想要两个演员交流。我在本地机器上有一个本地系统(客户机),在EC2上有一个远程参与者(服务器)。但是我无法从客户端系统向远程参与者发送消息。

testClient.fs

代码语言:javascript
复制
#if INTERACTIVE
#time "on"
#r "nuget: Akka.FSharp" 
#r "nuget: Akka.TestKit" 
#endif

open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open System.Collections.Generic

let configuration = 
                    ConfigurationFactory.ParseString(
                        @"akka {
                            actor {
                                provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                            }
                            remote {
                             transport = ""akka.remote.netty.NettyRemoteTransport""
                             netty {
                               hostname = localhost
                               port = 0
                             }
                           }
                        }")

let system = ActorSystem.Create("System", configuration)

[<EntryPoint>]
let main args =               
    let remoteClient = system.ActorSelection(
                            "akka.tcp://RemoteSystem@A.B.C.D:2552/user/remoteActor")
    printfn "%A" remoteClient
    remoteClient <! "message from client"
    Console.ReadLine() |> ignore
    0

testServer.fs

代码语言:javascript
复制
#if INTERACTIVE
#time "on"
#r "nuget: Akka.FSharp" 
#r "nuget: Akka.TestKit" 
#endif
open System
open Akka.Actor
open Akka.Configuration
open Akka.FSharp
open System.Collections.Generic

let helper msg = printfn "hello from server : %A" msg

let configuration = 
                    ConfigurationFactory.ParseString(
                        @"akka {
                            actor {
                                provider = ""Akka.Remote.RemoteActorRefProvider, Akka.Remote""
                            }
                            remote {
                             transport = ""akka.remote.netty.NettyRemoteTransport""
                             netty {
                               hostname = ""A.B.C.D""
                               port = 2552
                             }
                           }
                        }")

let remoteSystem = ActorSystem.Create("RemoteSystem", configuration)

let createActor (f : 'a -> unit) = actorOf f

[<EntryPoint>]
let main args =  
  let remoteActor = createActor helper |> spawn remoteSystem "remoteActor"
  Console.ReadLine() |> ignore
  0

首先,当我启动我的服务器和运行客户机时,它会依次查找远程参与者并发送一条消息。然后我在EC2上的服务器上得到了以下错误。

INFOThread 0001启动远程处理INFOThread 0001远程处理已启动;监听地址: akka.tcp://RemoteSystem@0.0.0.0:255209/25/2020 19:20:08远程处理(akka://RemoteSystem)远程处理现在监听地址: akka.tcp://RemoteSystem@0.0.0.0:2552 RemoteSystem 0007正在删除非本地收件人的邮件Akka.Actor.ActorSelectionMessage [ akka.tcp://RemoteSystem@A.B.C.D:2552 /]到达akka.tcp://RemoteSystem@A.B.C.D:2552入站地址akka.tcp://RemoteSystem@0.0.0.0:2552

远程处理现在侦听地址:akka.tcp:// INFOThread @0.0.0.0:25529/25/ INFOThread 7:20:22 PMremoting (akka://System) remoting现在侦听地址: akka.tcp://System@0.0.0.0:2552 ActorSelectionAnchor(akka.tcp://RemoteSystem@A.B.C.D:2552/),Path(/INFOThread/INFOThread)

然后我搜索了很多次这个错误,并在服务器上的配置文件中尝试了以下选项: public-hostname = localhost,bind-hostname = ""A1.B1.C1.D1"“其中""A1.B1.C1.D1"”是EC2实例的私有IP地址,bind-port = 2552

可能的错误是什么?有没有办法解决这个问题?谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-09-28 00:47:43

我的猜测是,这是由于NAT的参与。你需要告诉Akka你的外部/内部主机名是什么:

https://doc.akka.io/docs/akka/current/remoting.html#akka-behind-nat-or-in-a-docker-container

如果涉及2个NAT级别,则可能需要一些额外的试错。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64070431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档