Inheritance: ClusterNodeContextBase
 public UserActorTest(ITestOutputHelper output, ClusterContextFixture clusterContextFixture)
     : base(output: output)
 {
     clusterContextFixture.Initialize(Sys);
     _clusterContext = clusterContextFixture.Context;
     _client         = new MockClient(_clusterContext);
 }
Ejemplo n.º 2
0
 public GameWorker(ClusterNodeContext context, Config config)
 {
     _context         = context;
     _channelType     = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
     _listenEndPoint  = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));
     _connectEndPoint = new IPEndPoint(IPAddress.Parse(config.GetString("address", "127.0.0.1")), config.GetInt("port", 0));
 }
Ejemplo n.º 3
0
 public GameBotActor(ClusterNodeContext clusterContext,
                     GameRef game, long userId, string userName)
 {
     _logger   = LogManager.GetLogger($"GameBotActor({userId}, {userName})");
     _game     = game;
     _userId   = userId;
     _userName = userName;
 }
Ejemplo n.º 4
0
 public GameBotActor(ClusterNodeContext clusterContext,
                     GameRef game, long userId, string userName)
 {
     _logger = LogManager.GetLogger($"GameBotActor({userId}, {userName})");
     _game = game;
     _userId = userId;
     _userName = userName;
 }
Ejemplo n.º 5
0
        public GamePairMakerActor(ClusterNodeContext clusterContext)
        {
            _clusterContext = clusterContext;

            _clusterContext.ClusterActorDiscovery.Tell(
                new ClusterActorDiscoveryMessage.RegisterActor(Self, nameof(IGamePairMaker)),
                Self);

            _pairingQueue = new List<QueueEntity>();
        }
Ejemplo n.º 6
0
        public void Dispose()
        {
            if (Context == null)
            {
                return;
            }

            Context.System.Terminate().Wait();
            Context = null;
        }
Ejemplo n.º 7
0
        public UserWorker(ClusterNodeContext context, Config config)
        {
            _context = context;
            _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
            _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));

            var connectAddress = config.GetString("connect-address");
            var connectPort = config.GetInt("connect-port", _listenEndPoint.Port);
            _connectEndPoint = new IPEndPoint(connectAddress != null ? IPAddress.Parse(connectAddress) : IPAddress.Loopback, connectPort);
        }
Ejemplo n.º 8
0
        public GamePairMakerActor(ClusterNodeContext clusterContext)
        {
            _clusterContext = clusterContext;

            _clusterContext.ClusterActorDiscovery.Tell(
                new ClusterActorDiscoveryMessage.RegisterActor(Self, nameof(IGamePairMaker)),
                Self);

            _pairingQueue = new List <QueueEntity>();
        }
Ejemplo n.º 9
0
        public UserWorker(ClusterNodeContext context, Config config)
        {
            _context        = context;
            _channelType    = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
            _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));

            var connectAddress = config.GetString("connect-address");
            var connectPort    = config.GetInt("connect-port", _listenEndPoint.Port);

            _connectEndPoint = new IPEndPoint(connectAddress != null ? IPAddress.Parse(connectAddress) : IPAddress.Loopback, connectPort);
        }
Ejemplo n.º 10
0
        public MockClient(ClusterNodeContext clusterContex)
        {
            _clusterContext = clusterContex;

            var channel = new TestActorRef <TestActorBoundChannel>(
                _clusterContext.System,
                Props.Create(() => new TestActorBoundChannel(CreateInitialActor)));

            Channel    = channel.UnderlyingActor;
            ChannelRef = channel.Cast <ActorBoundChannelRef>();

            UserLogin = Channel.CreateRef <UserLoginRef>();
        }
Ejemplo n.º 11
0
        public void Initialize(ActorSystem system)
        {
            DeadRequestProcessingActor.Install(system);

            var context = new ClusterNodeContext {
                System = system
            };

            context.ClusterActorDiscovery = system.ActorOf(Props.Create(
                                                               () => new ClusterActorDiscovery(null)));

            context.UserTable = new DistributedActorTableRef <long>(system.ActorOf(
                                                                        Props.Create(() => new DistributedActorTable <long>(
                                                                                         "User", context.ClusterActorDiscovery, null, null)),
                                                                        "UserTable"));

            _userTableContainer = new DistributedActorTableContainerRef <long>(system.ActorOf(
                                                                                   Props.Create(() => new DistributedActorTableContainer <long>(
                                                                                                    "User", context.ClusterActorDiscovery, typeof(UserActorFactory), new object[] { context }, InterfacedPoisonPill.Instance)),
                                                                                   "UserTableContainer"));

            Context = context;
        }
Ejemplo n.º 12
0
 public UserTableWorker(ClusterNodeContext context, Config config)
 {
     _context = context;
 }
Ejemplo n.º 13
0
 public GamePairMakerWorker(ClusterNodeContext context, Config config)
 {
     _context = context;
 }
Ejemplo n.º 14
0
 public GameActor(ClusterNodeContext clusterContext, long id, CreateGameParam param)
 {
     _logger = LogManager.GetLogger($"GameActor({id})");
     _clusterContext = clusterContext;
     _id = id;
 }
Ejemplo n.º 15
0
 public GameActor(ClusterNodeContext clusterContext, long id, CreateGameParam param)
 {
     _logger         = LogManager.GetLogger($"GameActor({id})");
     _clusterContext = clusterContext;
     _id             = id;
 }
Ejemplo n.º 16
0
 public void Initialize(object[] args)
 {
     _clusterContext = (ClusterNodeContext)args[0];
 }
Ejemplo n.º 17
0
 public UserActor(ClusterNodeContext clusterContext, long id)
 {
     _logger         = LogManager.GetLogger($"UserActor({id})");
     _clusterContext = clusterContext;
     _id             = id;
 }
Ejemplo n.º 18
0
 public UserLoginActor(ClusterNodeContext clusterContext, ActorBoundChannelRef channel, EndPoint clientRemoteEndPoint)
 {
     _logger = LogManager.GetLogger($"UserLoginActor({clientRemoteEndPoint})");
     _clusterContext = clusterContext;
     _channel = channel;
 }
Ejemplo n.º 19
0
 public UserTableWorker(ClusterNodeContext context, Config config)
 {
     _context = context;
 }
Ejemplo n.º 20
0
 public GamePairMakerWorker(ClusterNodeContext context, Config config)
 {
     _context = context;
 }
Ejemplo n.º 21
0
 public void Initialize(object[] args)
 {
     _clusterContext = (ClusterNodeContext)args[0];
 }
Ejemplo n.º 22
0
 public UserActor(ClusterNodeContext clusterContext, long id)
 {
     _logger = LogManager.GetLogger($"UserActor({id})");
     _clusterContext = clusterContext;
     _id = id;
 }
Ejemplo n.º 23
0
 public UserLoginActor(ClusterNodeContext clusterContext, ActorBoundChannelRef channel, EndPoint clientRemoteEndPoint)
 {
     _logger         = LogManager.GetLogger($"UserLoginActor({clientRemoteEndPoint})");
     _clusterContext = clusterContext;
     _channel        = channel;
 }
Ejemplo n.º 24
0
 public GameWorker(ClusterNodeContext context, Config config)
 {
     _context = context;
     _channelType = (ChannelType)Enum.Parse(typeof(ChannelType), config.GetString("type", "Tcp"), true);
     _listenEndPoint = new IPEndPoint(IPAddress.Any, config.GetInt("port", 0));
     _connectEndPoint = new IPEndPoint(IPAddress.Parse(config.GetString("address", "127.0.0.1")), config.GetInt("port", 0));
 }