Akka ClusterClient实际上并不发送GetContacts

时间:2017-08-30 12:20:11

标签: .net akka akka.net akka-cluster

我遇到了实现Akka Cluster Client的问题,因为看起来ClusterClient实际上从未发送过GetContacts消息,即使它指示它正在发送它(在调试日志中)。

我确信邮件没有被发送,因为我正在运行服务器(接待员)的盒子和客户端(ClusterClient)运行的位置之间运行网络捕获,我看到指示的端口上没有数据包据称ClusterClient正在发送的地方。

我已经多次查看了所有的配置,我看不出有什么问题,而且日志表明正在发送GetContacts这一事实,但是网络没有任何东西让我完全糊涂。

服务器在初始化并且8092端口正在侦听之后不记录任何消息或错误(我在netstat中看到它,我可以telnet到它)。似乎客户端实际上从未实际向服务器端口8092发送消息。我也尝试在本地系统上运行此操作,使用127.0.0.1作为服务器和客户端的主机名,我看到同样的问题,没有发送数据包从客户端进程到服务器进程。

以下是客户端日志,其中包括akka HOCON配置。 GetContacts不断重复,并且在启动后几秒钟(7:46:24),客户端尝试使用ClusterClient发送消息,但是它接收"接收者不可用,缓冲消息类型......"

服务器日志和代码低于客户端日志和代码

客户端调试日志

2017-08-30 07:46:19.4991 Akka.Event.EventStream 6 Default Loggers started 
2017-08-30 07:46:19.4991 Akka.Event.LoggingBus+UnhandledMessageForwarder 6 Started (Akka.Event.LoggingBus+UnhandledMessageForwarder) 
2017-08-30 07:46:19.4991 Akka.Event.DummyClassForStringSources 6 Starting remoting 
2017-08-30 07:46:19.4991 Akka.Actor.SystemGuardianActor 6 now supervising akka://ClientSystem/system/remoting-terminator 
2017-08-30 07:46:19.4991 Akka.Actor.SystemGuardianActor 6 now supervising akka://ClientSystem/system/transports 
2017-08-30 07:46:19.4991 Akka.Actor.SystemGuardianActor 6 now supervising akka://ClientSystem/system/endpointManager 
2017-08-30 07:46:19.4991 Akka.Remote.TransportSupervisor 6 Started (Akka.Remote.TransportSupervisor) 
2017-08-30 07:46:19.4991 Akka.Event.DummyClassForStringSources 6 Starting prune timer for endpoint manager... 
2017-08-30 07:46:19.4991 Akka.Remote.EndpointManager 6 Started (Akka.Remote.EndpointManager) 
2017-08-30 07:46:19.4991 Akka.Remote.RemoteActorRefProvider+RemotingTerminator 6 Started (Akka.Remote.RemoteActorRefProvider+RemotingTerminator) 
2017-08-30 07:46:19.4991 Akka.Remote.RemoteActorRefProvider+RemotingTerminator 6 now watched by [akka://ClientSystem/system] 
2017-08-30 07:46:19.4991 Akka.Remote.Transport.AkkaProtocolManager 6 Started (Akka.Remote.Transport.AkkaProtocolManager) 
2017-08-30 07:46:19.4991 Akka.Remote.TransportSupervisor 6 now supervising akka://ClientSystem/system/transports/akkaprotocolmanager.tcp.0 
2017-08-30 07:46:19.4991 Akka.Event.DummyClassForStringSources 6 Remoting started; listening on addresses : [akka.tcp://ClientSystem@10.20.123.42:23695] 
2017-08-30 07:46:19.4991 Akka.Event.DummyClassForStringSources 6 Remoting now listens on addresses: [akka.tcp://ClientSystem@10.20.123.42:23695] 
2017-08-30 07:46:19.5191 Akka.Event.DummyClassForStringSources 5 Cluster Node [akka.tcp://ClientSystem@10.20.123.42:23695] - Starting up... 
2017-08-30 07:46:19.5191 Akka.Actor.SystemGuardianActor 3 now supervising akka://ClientSystem/system/cluster 
2017-08-30 07:46:19.5301 Akka.Actor.SystemGuardianActor 3 now supervising akka://ClientSystem/system/clusterEventBusListener 
2017-08-30 07:46:19.5452 Akka.Cluster.ClusterDaemon 8 Started (Akka.Cluster.ClusterDaemon) 
2017-08-30 07:46:19.5452 Akka.Cluster.ClusterDaemon 8 now supervising akka://ClientSystem/system/cluster/core 
2017-08-30 07:46:19.5452 Akka.Cluster.ClusterDaemon 8 now supervising akka://ClientSystem/system/cluster/heartbeatReceiver 
2017-08-30 07:46:19.5452 Akka.Cluster.ClusterCoreSupervisor 6 Started (Akka.Cluster.ClusterCoreSupervisor) 
2017-08-30 07:46:19.5452 Akka.Cluster.ClusterHeartbeatReceiver 5 Started (Akka.Cluster.ClusterHeartbeatReceiver) 
2017-08-30 07:46:19.5693 Akka.Event.DummyClassForStringSources 6 Cluster Node [akka.tcp://ClientSystem@10.20.123.42:23695] - Started up successfully 
2017-08-30 07:46:19.5693 Akka.Cluster.ClusterCoreSupervisor 6 now supervising akka://ClientSystem/system/cluster/core/publisher 
2017-08-30 07:46:19.5693 Akka.Cluster.ClusterCoreSupervisor 6 now supervising akka://ClientSystem/system/cluster/core/daemon 
2017-08-30 07:46:19.5693 Akka.Actor.SystemGuardianActor 5 now supervising akka://ClientSystem/system/remote-watcher 
2017-08-30 07:46:19.5693 Akka.Actor.SystemGuardianActor 5 now supervising akka://ClientSystem/system/remote-deployment-watcher 
2017-08-30 07:46:19.5693 Akka.Actor.SystemGuardianActor 21 now supervising akka://ClientSystem/system/deadLetterListener 
2017-08-30 07:46:19.5693 Akka.Event.EventStream 5 subscribing [akka://ClientSystem/system/deadLetterListener#1224522872] to channel Akka.Event.DeadLetter 
2017-08-30 07:46:19.5693 Akka.Event.DeadLetterListener 5 Started (Akka.Event.DeadLetterListener) 
2017-08-30 07:46:19.5693 Akka.Remote.RemoteDeploymentWatcher 5 Started (Akka.Remote.RemoteDeploymentWatcher) 
2017-08-30 07:46:19.5693 Akka.Actor.SystemGuardianActor 19 now supervising akka://ClientSystem/system/EventStreamUnsubscriber-1 
2017-08-30 07:46:19.5693 Akka.Event.EventStreamUnsubscriber 21 registering unsubscriber with Akka.Event.EventStream 
2017-08-30 07:46:19.5693 Akka.Actor.Internal.ActorSystemImpl 3 NewtonSoftJsonSerializer has been detected as a default serializer. It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Hyperion (for more info visit: http://getakka.net/docs/Serialization#how-to-setup-hyperion-as-default-serializer ). If you want to suppress this message set HOCON `akka.suppress-json-serializer-warning` config flag to on. 
2017-08-30 07:46:19.5793 Akka.Event.EventStreamUnsubscriber 3 Started (Akka.Event.EventStreamUnsubscriber) 
2017-08-30 07:46:19.5793 Akka.Cluster.ClusterDomainEventPublisher 3 Started (Akka.Cluster.ClusterDomainEventPublisher) 
2017-08-30 07:46:19.5793 Akka.Actor.Internal.ActorSystemImpl 3   akka : {
    log-config-on-start : on
    stdout-loglevel : DEBUG
    loglevel : DEBUG
    loggers : ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"]
    actor : {
      serialize-messages : on
      serialize-creators : on
      provider : "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
      debug : {
        receive : on
        autoreceive : on
        lifecycle : on
        event-stream : on
        unhandled : on
      }
    }
    remote : {
      log-received-messages : on
      log-sent-messages : on
      enabled-transports : [akka.remote.dot-netty.tcp]
      dot-netty : {
        tcp : {
          transport-protocol : tcp
          port : 0
          hostname : 10.20.123.42
        }
      }
      log-remote-lifecycle-events : DEBUG
    }
    cluster : {
      client : {
        initial-contacts : ["akka.tcp://NGOMSCluster@10.20.223.45:8092/system/receptionist"]
      }
    }
  }

2017-08-30 07:46:19.5793 Akka.Actor.GuardianActor 3 now supervising akka://ClientSystem/user/ordertracker 
2017-08-30 07:46:19.5793 Akka.Event.EventStream 3 subscribing [akka://ClientSystem/system/cluster/core/daemon#1545645994] to channel Akka.Remote.QuarantinedEvent 
2017-08-30 07:46:19.5793 Akka.Cluster.ClusterCoreDaemon 3 No seed-nodes configured, manual cluster join required 
2017-08-30 07:46:19.5793 Akka.Cluster.ClusterCoreDaemon 3 Started (Akka.Cluster.ClusterCoreDaemon) 
2017-08-30 07:46:19.5793 Akka.Cluster.ClusterCoreDaemon 3 now watched by [akka://ClientSystem/system/cluster/core#515725268] 
2017-08-30 07:46:19.5943 ClientPump.OrderTracker 5 Order Tracker Started 
2017-08-30 07:46:19.5943 ClientPump.OrderTracker 19 Started (ClientPump.OrderTracker) 
2017-08-30 07:46:19.5943 ClientPump.OrderTracker 19 now supervising akka://ClientSystem/user/ordertracker/crouter 
2017-08-30 07:46:19.5943 Akka.Cluster.Tools.Client.ClusterClient 8 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:19.5943 Akka.Cluster.Tools.Client.ClusterClient 5 Started (Akka.Cluster.Tools.Client.ClusterClient) 
2017-08-30 07:46:19.6074 Akka.Cluster.Tools.Client.ClusterClient 19 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:19.6074 Akka.Remote.EndpointManager 8 now supervising akka://ClientSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FNGOMSCluster%4010.20.223.45%3A8092-1 
2017-08-30 07:46:19.6074 Akka.Remote.ReliableDeliverySupervisor 5 Started (Akka.Remote.ReliableDeliverySupervisor) 
2017-08-30 07:46:19.6074 Akka.Remote.ReliableDeliverySupervisor 5 now watched by [akka://ClientSystem/system/endpointManager#268440055] 
2017-08-30 07:46:19.6074 Akka.Remote.ReliableDeliverySupervisor 5 now supervising akka://ClientSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FNGOMSCluster%4010.20.223.45%3A8092-1/endpointWriter 
2017-08-30 07:46:19.6074 Akka.Remote.EndpointWriter 19 Started (Akka.Remote.EndpointWriter) 
2017-08-30 07:46:19.6074 Akka.Remote.EndpointWriter 19 now watched by [akka://ClientSystem/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FNGOMSCluster%4010.20.223.45%3A8092-1#1733941078] 
2017-08-30 07:46:19.6384 Akka.Cluster.ClusterRemoteWatcher 8 Started (Akka.Cluster.ClusterRemoteWatcher) 
2017-08-30 07:46:19.6384 Akka.Cluster.ClusterReadView+EventBusListener 5 Started (Akka.Cluster.ClusterReadView+EventBusListener) 
2017-08-30 07:46:19.6384 Akka.Cluster.ClusterCoreDaemon 19 [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:46:19.6384 Akka.Cluster.ClusterCoreDaemon 20 [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:46:19.6856 Akka.Event.EventStream 6 subscribing [akka://ClientSystem/system/remote-watcher#92163059] to channel Akka.Cluster.ClusterEvent+IMemberEvent 
2017-08-30 07:46:19.6856 Akka.Event.EventStream 4 subscribing [akka://ClientSystem/system/clusterEventBusListener#2106616419] to channel Akka.Cluster.ClusterEvent+IClusterDomainEvent 
2017-08-30 07:46:22.6062 Akka.Cluster.Tools.Client.ClusterClient 3 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:24.1453 ClientPump.OrderTracker 3 Send Order Received, will try to send to akka://ClientSystem 
2017-08-30 07:46:24.1524 Akka.Cluster.Tools.Client.ClusterClient 19 Receptionist not available, buffering message type [SendToAll] 
2017-08-30 07:46:24.1524 Akka.Cluster.Tools.Client.ClusterClient 6 Receptionist not available, buffering message type [Send] 
2017-08-30 07:46:24.1524 ClientPump.OrderTracker 6 received handled message ClientPump.SendOrder from akka://ClientSystem/deadLetters 
2017-08-30 07:46:25.6163 Akka.Cluster.Tools.Client.ClusterClient 3 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:28.6254 Akka.Cluster.Tools.Client.ClusterClient 8 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:31.6354 Akka.Cluster.Tools.Client.ClusterClient 20 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:34.6464 Akka.Cluster.Tools.Client.ClusterClient 4 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:37.6555 Akka.Cluster.Tools.Client.ClusterClient 20 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:40.6665 Akka.Cluster.Tools.Client.ClusterClient 6 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]] 
2017-08-30 07:46:43.6764 Akka.Cluster.Tools.Client.ClusterClient 21 Sending GetContacts to [ActorSelection[Anchor(akka.tcp://NGOMSCluster@10.20.223.45:8092/), Path(/system/receptionist)]]

客户代码

class OrderTracker : ReceiveActor, ILogReceive
{
    private static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();

    public OrderTracker()
    {

        var settings = ClusterClientSettings.Create(Context.System);

        var clusterClient = Context.ActorOf(ClusterClient.Props(settings), "crouter");

        log.Info("Order Tracker Started");
        Receive<OrderMessage>(o =>
            {
                log.Info(o.ClientID + "," + o.OrderID.ToString() + "," + o.State.ToString() + "," + o.Side.ToString() + "," + o.Symbol + "," + o.Price.ToString() + "," + o.Quantity.ToString());
            });

        Receive<SendOrder>(o =>
            {
                log.Info("Send Order Received, will try to send to " + clusterClient.Path.Address.ToString());
                clusterClient.Tell(new ClusterClient.SendToAll("/user/manager/client", o.Message));
                clusterClient.Tell(new ClusterClient.Send("/user/manager/client", o.Message));
            });
    }
}

}

服务器日志

2017-08-30 07:44:48.1624 Akka.Event.LoggingBus+UnhandledMessageForwarder 6 Started (Akka.Event.LoggingBus+UnhandledMessageForwarder) 
2017-08-30 07:44:48.1624 Akka.Event.EventStream 6 Default Loggers started 
2017-08-30 07:44:48.1624 Akka.Actor.SystemGuardianActor 6 now supervising akka://NGOMSCluster/system/remoting-terminator 
2017-08-30 07:44:48.1624 Akka.Actor.SystemGuardianActor 6 now supervising akka://NGOMSCluster/system/transports 
2017-08-30 07:44:48.1624 Akka.Event.DummyClassForStringSources 6 Starting remoting 
2017-08-30 07:44:48.1624 Akka.Remote.TransportSupervisor 6 Started (Akka.Remote.TransportSupervisor) 
2017-08-30 07:44:48.1624 Akka.Actor.SystemGuardianActor 6 now supervising akka://NGOMSCluster/system/endpointManager 
2017-08-30 07:44:48.1624 Akka.Remote.RemoteActorRefProvider+RemotingTerminator 6 Started (Akka.Remote.RemoteActorRefProvider+RemotingTerminator) 
2017-08-30 07:44:48.1624 Akka.Event.DummyClassForStringSources 6 Starting prune timer for endpoint manager... 
2017-08-30 07:44:48.1624 Akka.Remote.EndpointManager 6 Started (Akka.Remote.EndpointManager) 
2017-08-30 07:44:48.1624 Akka.Remote.RemoteActorRefProvider+RemotingTerminator 6 now watched by [akka://NGOMSCluster/system] 
2017-08-30 07:44:48.1724 Akka.Remote.Transport.AkkaProtocolManager 6 Started (Akka.Remote.Transport.AkkaProtocolManager) 
2017-08-30 07:44:48.1724 Akka.Remote.TransportSupervisor 6 now supervising akka://NGOMSCluster/system/transports/akkaprotocolmanager.tcp.0 
2017-08-30 07:44:48.1724 Akka.Event.DummyClassForStringSources 6 Remoting started; listening on addresses : [akka.tcp://NGOMSCluster@10.20.223.45:8092] 
2017-08-30 07:44:48.1724 Akka.Event.DummyClassForStringSources 6 Remoting now listens on addresses: [akka.tcp://NGOMSCluster@10.20.223.45:8092] 
2017-08-30 07:44:48.1724 Akka.Event.DummyClassForStringSources 6 Cluster Node [akka.tcp://NGOMSCluster@10.20.223.45:8092] - Starting up... 
2017-08-30 07:44:48.1724 Akka.Actor.SystemGuardianActor 6 now supervising akka://NGOMSCluster/system/cluster 
2017-08-30 07:44:48.1724 Akka.Actor.SystemGuardianActor 6 now supervising akka://NGOMSCluster/system/clusterEventBusListener 
2017-08-30 07:44:48.1884 Akka.Cluster.ClusterDaemon 5 Started (Akka.Cluster.ClusterDaemon) 
2017-08-30 07:44:48.1884 Akka.Cluster.ClusterDaemon 5 now supervising akka://NGOMSCluster/system/cluster/core 
2017-08-30 07:44:48.1884 Akka.Cluster.ClusterDaemon 5 now supervising akka://NGOMSCluster/system/cluster/heartbeatReceiver 
2017-08-30 07:44:48.1884 Akka.Cluster.ClusterCoreSupervisor 5 Started (Akka.Cluster.ClusterCoreSupervisor) 
2017-08-30 07:44:48.1884 Akka.Cluster.ClusterHeartbeatReceiver 5 Started (Akka.Cluster.ClusterHeartbeatReceiver) 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterCoreSupervisor 7 now supervising akka://NGOMSCluster/system/cluster/core/publisher 
2017-08-30 07:44:48.2084 Akka.Event.DummyClassForStringSources 7 Cluster Node [akka.tcp://NGOMSCluster@10.20.223.45:8092] - Started up successfully 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterCoreSupervisor 7 now supervising akka://NGOMSCluster/system/cluster/core/daemon 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterReadView+EventBusListener 7 Started (Akka.Cluster.ClusterReadView+EventBusListener) 
2017-08-30 07:44:48.2084 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/remote-watcher 
2017-08-30 07:44:48.2084 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/remote-deployment-watcher 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterDomainEventPublisher 7 Started (Akka.Cluster.ClusterDomainEventPublisher) 
2017-08-30 07:44:48.2084 Akka.Remote.RemoteDeploymentWatcher 7 Started (Akka.Remote.RemoteDeploymentWatcher) 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterRemoteWatcher 4 Started (Akka.Cluster.ClusterRemoteWatcher) 
2017-08-30 07:44:48.2084 Akka.Event.EventStream 20 subscribing [akka://NGOMSCluster/system/cluster/core/daemon#658632128] to channel Akka.Remote.QuarantinedEvent 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterCoreDaemon 20 Started (Akka.Cluster.ClusterCoreDaemon) 
2017-08-30 07:44:48.2084 Akka.Cluster.ClusterCoreDaemon 20 now watched by [akka://NGOMSCluster/system/cluster/core#1737578814] 
2017-08-30 07:44:48.2194 Akka.Cluster.ClusterCoreDaemon 20 [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2194 Akka.Cluster.ClusterCoreDaemon 20 [Uninitialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2194 Akka.Cluster.ClusterCoreDaemon 20 [Uninitialized] Received Akka.Cluster.InternalClusterAction+JoinSeedNodes 
2017-08-30 07:44:48.2194 Akka.Cluster.ClusterCoreDaemon 6 [Uninitialized] Received Akka.Cluster.ClusterUserAction+JoinTo 
2017-08-30 07:44:48.2194 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/distributedPubSubMediator 
2017-08-30 07:44:48.2454 Akka.Actor.Internal.ActorSystemImpl 7 NewtonSoftJsonSerializer has been detected as a default serializer. It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Hyperion (for more info visit: http://getakka.net/docs/Serialization#how-to-setup-hyperion-as-default-serializer ). If you want to suppress this message set HOCON `akka.suppress-json-serializer-warning` config flag to on. 
2017-08-30 07:44:48.2524 Akka.Cluster.Tools.PublishSubscribe.DistributedPubSubMediator 7 Started (Akka.Cluster.Tools.PublishSubscribe.DistributedPubSubMediator) 
2017-08-30 07:44:48.2524 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/receptionist 
2017-08-30 07:44:48.2524 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/deadLetterListener 
2017-08-30 07:44:48.2524 Akka.Actor.SystemGuardianActor 7 now supervising akka://NGOMSCluster/system/EventStreamUnsubscriber-1 
2017-08-30 07:44:48.2524 Akka.Actor.Internal.ActorSystemImpl 7   akka : {
    log-config-on-start : on
    stdout-loglevel : DEBUG
    loglevel : DEBUG
    loggers : ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"]
    extensions : ["Akka.Cluster.Tools.Client.ClusterClientReceptionistExtensionProvider, Akka.Cluster.Tools"]
    actor : {
      serialize-creators : on
      provider : "Akka.Cluster.ClusterActorRefProvider, Akka.Cluster"
      debug : {
        receive : on
        fsm : on
        event-stream : on
        router-misconfiguration : on
        autoreceive : on
        lifecycle : on
        unhandled : on
      }
    }
    remote : {
      log-received-messages : on
      log-sent-messages : on
      enabled-transports : [akka.remote.dot-netty.tcp]
      dot-netty : {
        tcp : {
          transport-protocol : tcp
          port : 8092
          hostname : 10.20.223.45
        }
      }
      log-remote-lifecycle-events : DEBUG
    }
    cluster : {
      log-info : on
      seed-nodes : ["akka.tcp://NGOMSCluster@10.20.223.45:8092"]
      debug : {
        verbose-heartbeat-logging : off
      }
    }
  }

2017-08-30 07:44:48.2524 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/deadLetterListener#2069104233] to channel Akka.Event.DeadLetter 
2017-08-30 07:44:48.2524 Akka.Event.DeadLetterListener 7 Started (Akka.Event.DeadLetterListener) 
2017-08-30 07:44:48.2524 Akka.Event.EventStreamUnsubscriber 7 registering unsubscriber with Akka.Event.EventStream 
2017-08-30 07:44:48.2524 Akka.Event.EventStreamUnsubscriber 7 Started (Akka.Event.EventStreamUnsubscriber) 
2017-08-30 07:44:48.2524 Akka.Actor.GuardianActor 7 now supervising akka://NGOMSCluster/user/manager 
2017-08-30 07:44:48.2524 NGSOMS.ManagerActor 7 Started (NGSOMS.ManagerActor) 
2017-08-30 07:44:48.2524 NGSOMS.ManagerActor 7 now supervising akka://NGOMSCluster/user/manager/client 
2017-08-30 07:44:48.2524 Akka.Cluster.Tools.Client.ClusterReceptionist 7 Started (Akka.Cluster.Tools.Client.ClusterReceptionist) 
2017-08-30 07:44:48.2524 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/clusterEventBusListener#1987664108] to channel Akka.Cluster.ClusterEvent+IClusterDomainEvent 
2017-08-30 07:44:48.2524 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/remote-watcher#420721983] to channel Akka.Cluster.ClusterEvent+IMemberEvent 
2017-08-30 07:44:48.2524 NGSOMS.ClientActor 7 Receive Actor has moved to Ready 
2017-08-30 07:44:48.2524 NGSOMS.ClientActor 7 Client Ref is akka://NGOMSCluster/user/manager/client 
2017-08-30 07:44:48.2524 NGSOMS.ClientActor 7 Client Actor Starting ... 
2017-08-30 07:44:48.2524 NGSOMS.ClientActor 7 Started (NGSOMS.ClientActor) 
2017-08-30 07:44:48.2524 NGSOMS.ClientActor 7 now watched by [akka://NGOMSCluster/system/distributedPubSubMediator#796287490] 
2017-08-30 07:44:48.2524 Akka.Cluster.ClusterHeartbeatSender 7 Started (Akka.Cluster.ClusterHeartbeatSender) 
2017-08-30 07:44:48.2524 Akka.Cluster.ClusterCoreDaemon 7 Node [akka.tcp://NGOMSCluster@10.20.223.45:8092] is JOINING, roles [] 
2017-08-30 07:44:48.2804 Akka.Cluster.ClusterCoreDaemon 5 Leader is moving node [akka.tcp://NGOMSCluster@10.20.223.45:8092] to [Up] 
2017-08-30 07:44:48.2814 Akka.Cluster.ClusterCoreDaemon 7 now supervising akka://NGOMSCluster/system/cluster/core/daemon/heartbeatSender 
2017-08-30 07:44:48.2814 Akka.Cluster.ClusterCoreDaemon 21 [Initialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2814 Akka.Cluster.ClusterCoreDaemon 21 [Initialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2814 Akka.Cluster.ClusterCoreDaemon 21 [Initialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2814 Akka.Cluster.ClusterCoreDaemon 21 [Initialized] Received Akka.Cluster.InternalClusterAction+Subscribe 
2017-08-30 07:44:48.2814 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/distributedPubSubMediator#796287490] to channel Akka.Cluster.ClusterEvent+IMemberEvent 
2017-08-30 07:44:48.2814 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/user/manager#1738083469] to channel Akka.Cluster.ClusterEvent+MemberUp 
2017-08-30 07:44:48.2814 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/receptionist#1611611694] to channel Akka.Cluster.ClusterEvent+IMemberEvent 
2017-08-30 07:44:48.2814 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/cluster/core/daemon/heartbeatSender#1833894805] to channel Akka.Cluster.ClusterEvent+IMemberEvent 
2017-08-30 07:44:48.2814 Akka.Event.EventStream 7 subscribing [akka://NGOMSCluster/system/cluster/core/daemon/heartbeatSender#1833894805] to channel Akka.Cluster.ClusterEvent+IReachabilityEvent 

服务器代码 - 创建/经理演员

static void Main(string[] args)
{

    var system = ActorSystem.Create("NGOMSCluster");

    ActorSystemRefs.ManagerActor = system.ActorOf(Props.Create(() => new ManagerActor()), "manager");

    Console.ReadLine();

}

服务器代码 - 创建/经理/客户端演员

class ManagerActor : UntypedActor, IWithUnboundedStash
{
    private readonly ILoggingAdapter _log = Logging.GetLogger(Context);
    private IActorRef _clientActor;
    private IActorRef _exchangeActor;
    protected Akka.Cluster.Cluster Cluster = Akka.Cluster.Cluster.Get(Context.System);
    protected Dictionary<long, OrderMessage> masterOrderList;
    protected Dictionary<long, OrderTrack> orderTracking;

    /// <summary>
    /// Need to subscribe to cluster changes
    /// </summary>
    protected override void PreStart()
    {
        Cluster.Subscribe(Self, new[] { typeof(ClusterEvent.MemberUp) });
        //_clientActor = ActorSystemRefs.ClientActor = Context.ActorOf(Props.Create(() => new ClientActor()), "client");
        _clientActor = ActorSystemRefs.ClientActor = Context.ActorOf(Props.Create<ClientActor>(), "client");
        ClusterClientReceptionist.Get(Context.System).RegisterService(_clientActor);
    }

    /// <summary>
    /// Re-subscribe on restart
    /// </summary>
    protected override void PostStop()
    {
        Cluster.Unsubscribe(Self);
    }

    protected override void OnReceive(object message)
    {
        if (message is ClusterEvent.MemberUp)
        {
            _log.Info("Cluster is ready. Able to begin jobs.");
            //ready to begin routing messages to back-end
            Become(Ready);
            Stash.UnstashAll();
        }
        else
        {
            Stash.Stash();
        }
    }

    protected void Ready(object message)
    {
            //Bunch of stuff here for processing messages that come in
    }

    public IStash Stash { get; set; }

}

服务器代码 - / manager / client Actor

class ClientActor : ReceiveActor, ILoggingFSM, ILogReceive
    {
        private readonly ILoggingAdapter _log = Logging.GetLogger(Context);

        /// <summary>
        /// Need to subscribe to cluster changes
        /// </summary>
        protected override void PreStart()
        {
            _log.Info("Client Actor Starting ...");
        }

        public ClientActor()
        {
            Ready();
        }

        private void Ready()
        {
            _log.Info("Receive Actor has moved to Ready");
            _log.Info("Client Ref is " + Context.Self.Path.ToString());

            Receive<OrderMessage>(message =>
                {
                    var mes = message as OrderMessage;

                    //New Order Received
                    if (mes.State == OrderStates.New)
                    {
                        _log.Info("Order " + mes.OrderID.ToString() + " received");
                        //Send Order Message back to client router with ACK State
                        Sender.Tell(new OrderMessage(mes.ClientID, mes.OrderID, OrderStates.Acknowledged, mes.Side, mes.Symbol, mes.Price, mes.Quantity));
                        //send ordermessage manager for processing
                        ActorSystemRefs.ManagerActor.Tell(mes);
                    }
                    if (mes.State == OrderStates.Complete)
                    {
                        _log.Info("Order " + mes.OrderID.ToString() + " Completed");
                        //Send Order Message back to client router to indicate completed with Final Price
                        Context.ActorSelection("akka.tcp://ClientSystem@localhost:8091/user/ordertracker").Tell(mes);
                    }
                });

            Receive<OrderTrack>(message =>
                {
                    //Working Update Received, Should Forward Stats to Client Router
                });
        }
    }

这是我在两者之间运行的wireshark的剪辑。在我尝试发送消息几秒后刷新RDP窗口时,没有数据包可见(7:46:24)

Wireshark Screep Cap

0 个答案:

没有答案