예제 #1
0
        private void SendActorRegistrationMessage(ActorRegistration registration)
        {
            var routeReg = new InternalRouteRegistration
            {
                ReceiverIdentifier = registration.ActorIdentifier,
                MessageContracts   = registration.MessageHandlers
                                     .Select(mh => new MessageContract
                {
                    Message = mh.Identifier,
                    KeepRegistrationLocal = mh.KeepRegistrationLocal
                })
                                     .ToArray(),
                DestinationSocket = receivingSocket
            };

            internalRegistrationsSender.Send(routeReg);
        }
예제 #2
0
        public void AssignActor(IActor actor)
        {
            var registrations = actorHandlerMap.Add(actor);

            if (registrations.Any())
            {
                var actorRegistration = new ActorRegistration
                {
                    ActorIdentifier = actor.Identifier,
                    MessageHandlers = registrations
                };
                actorRegistrationsQueue.Enqueue(actorRegistration, cancellationTokenSource?.Token ?? CancellationToken.None);
            }
            else
            {
                logger.Warn($"Actor {actor.GetType().FullName}:{actor.Identifier} seems to not handle any message!");
            }
        }