在Akka.Remoting中解除了异常

时间:2016-07-13 06:11:03

标签: akka.net akka-remote-actor akka-remoting

使用Akka.net我试图实现简单的场景。 我创建了2个服务器和1个客户端,其中服务器接收从客户端发送的消息并对其进行处理。

安装程序有时工作正常,有时会出现以下错误,我无法找出原因:

**

No response from remote. Handshake timed out or transport failure detector triggered.
Cause: Unknown
Association with remote system akka.tcp://RemoteFSharp@172.27.**.94:8777 has
failed; address is now gated for 5000 ms. Reason is: [Akka.Remote.EndpointDisass
ociatedException: Disassociated
   at Akka.Remote.EndpointWriter.PublishAndThrow(Exception reason, LogLevel leve
l)
   at Akka.Remote.EndpointWriter.Unhandled(Object message)
   at Akka.Actor.ActorCell.<>c__DisplayClass109_0.<Akka.Actor.IUntypedActorConte
xt.Become>b__0(Object m)
   at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
   at Akka.Actor.ActorCell.ReceiveMessage(Object message)
   at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
   at Akka.Actor.ActorCell.Invoke(Envelope envelope)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Akka.Actor.ActorCell.HandleFailed(Failed f)
   at Akka.Actor.ActorCell.SystemInvoke(Envelope envelope)]

**

客户端配置:

akka {
       log-dead-letters-during-shutdown = off

        actor {
        handshake-timeout = 600 s

        serializers {
            wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
          }
        serialization-bindings {
          "System.Object" = wire
        }
          provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
        }
        remote {
            helios.tcp {
                maximum-frame-size = 20000000b
                tcp-keepalive = on
                transport-class =
          "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
                transport-protocol = tcp
                port = 8760
                hostname = 172.27.**.94
                }
          }
        log-remote-lifecycle-events = INFO
      }

服务器配置:

      akka {
        log-dead-letters-during-shutdown = off
        actor {

        handshake-timeout = 600 s
        serializers {
            wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
          }
        serialization-bindings {
          "System.Object" = wire
        }
          provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
        }
        remote {
        helios.tcp {
              maximum-frame-size = 20000000b
              tcp-keepalive = on
              transport-class =
        "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
              transport-protocol = tcp
              port = 8777
              hostname = 172.27.**.94
          }
          }
        log-remote-lifecycle-events = INFO
      }

我也使用Newtonsoft.Json进行序列化,如下所示:

let CreateEmployeeActor (system: ActorSystem) actorName  =
    (spawn system actorName
        (fun mailbox ->
            let rec loop (count: int)= 
                actor {
                    let! message = mailbox.Receive()
                    let sender = mailbox.Sender()
                    let deserializedEmailData = JsonConvert.DeserializeObject<EmployeeActorMsgs> (message)
                    match deserializedEmailData with
                    | InItEmployee ->
                //Some Logic

                }
            loop (0)
            ))

0 个答案:

没有答案