Ejemplo n.º 1
0
 public Unit TellSystem(SystemMessage message) => unit;
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 IterRoleMembers(d => d.TellSystem(message, sender));
Ejemplo n.º 3
0
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 ProcessOp.IO(() =>
 {
     var dto            = RemoteMessageDTO.Create(message, ProcessId, sender, Message.Type.System, message.Tag);
     var clientsReached = Cluster.PublishToChannel(ActorInboxCommon.ClusterSystemInboxNotifyKey(ProcessId), dto);
 });
Ejemplo n.º 4
0
 public Unit Kill() =>
 // TODO: Not yet implemented on the JS side
 ProcessId.Tell(SystemMessage.ShutdownProcess(false), ActorContext.Self);
Ejemplo n.º 5
0
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 Raise <Unit>();
Ejemplo n.º 6
0
 public Unit DispatchUnWatch(ProcessId watching) =>
 TellSystem(SystemMessage.DispatchUnWatch(watching), watching);
Ejemplo n.º 7
0
 public Unit Kill() =>
 TellSystem(SystemMessage.ShutdownProcess(false), ActorContext.Self);
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 Tell(message, sender, "user", Message.Type.System, message.Tag);
Ejemplo n.º 9
0
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 unit;
Ejemplo n.º 10
0
 public static Unit TellSystem(ProcessId pid, SystemMessage message) =>
 GetDispatcher(pid).TellSystem(message, Self);
Ejemplo n.º 11
0
 public Unit Shutdown() =>
 TellSystem(SystemMessage.ShutdownProcess(true), Self);
Ejemplo n.º 12
0
 public Unit Kill() =>
 TellSystem(SystemMessage.ShutdownProcess(false), Self);
Ejemplo n.º 13
0
 public Unit TellSystem(SystemMessage message) => unit;
        public static InboxDirective SystemMessageInbox <S, T>(Actor <S, T> actor, IActorInbox inbox, SystemMessage msg, ActorItem parent)
        {
            return(ActorContext.WithContext(new ActorItem(actor, inbox, actor.Flags), parent, ProcessId.NoSender, null, msg, msg.SessionId, () =>
            {
                switch (msg.Tag)
                {
                case Message.TagSpec.Restart:
                    if (inbox.IsPaused)
                    {
                        inbox.Unpause();
                    }
                    actor.Restart();
                    break;

                case Message.TagSpec.LinkChild:
                    var lc = msg as SystemLinkChildMessage;
                    actor.LinkChild(lc.Child);
                    break;

                case Message.TagSpec.UnlinkChild:
                    var ulc = msg as SystemUnLinkChildMessage;
                    actor.UnlinkChild(ulc.Child);
                    break;

                case Message.TagSpec.ChildFaulted:
                    var cf = msg as SystemChildFaultedMessage;
                    return actor.ChildFaulted(cf.Child, cf.Sender, cf.Exception, cf.Message);

                case Message.TagSpec.StartupProcess:
                    actor.Startup();
                    break;

                case Message.TagSpec.ShutdownProcess:
                    var sp = msg as ShutdownProcessMessage;
                    actor.ShutdownProcess(sp.MaintainState);
                    break;

                case Message.TagSpec.Unpause:
                    inbox.Unpause();
                    break;

                case Message.TagSpec.Pause:
                    inbox.Pause();
                    break;

                case Message.TagSpec.Watch:
                    var awm = msg as SystemAddWatcherMessage;
                    actor.AddWatcher(awm.Id);
                    break;

                case Message.TagSpec.UnWatch:
                    var rwm = msg as SystemRemoveWatcherMessage;
                    actor.RemoveWatcher(rwm.Id);
                    break;

                case Message.TagSpec.DispatchWatch:
                    var dwm = msg as SystemDispatchWatchMessage;
                    actor.DispatchWatch(dwm.Id);
                    break;

                case Message.TagSpec.DispatchUnWatch:
                    var duwm = msg as SystemDispatchUnWatchMessage;
                    actor.DispatchUnWatch(duwm.Id);
                    break;
                }
                return InboxDirective.Default;
            }));
        }
Ejemplo n.º 15
0
 public Unit Shutdown() =>
 TellSystem(SystemMessage.ShutdownProcess(true), ActorContext.Self);
Ejemplo n.º 16
0
 public Unit TellSystem(SystemMessage message, ProcessId sender) =>
 ProcessOp.IO(() => Inbox.TellSystem(message));
Ejemplo n.º 17
0
 public Unit UnWatch(ProcessId pid) =>
 TellSystem(SystemMessage.UnWatch(pid), pid);
 public Unit Shutdown() =>
 // TODO: Not yet implemented on the JS side
 ProcessId.Tell(SystemMessage.ShutdownProcess(true), Self);
Ejemplo n.º 19
0
        public static void SystemMessageInbox <S, T>(Actor <S, T> actor, IActorInbox inbox, SystemMessage msg, ActorItem parent)
        {
            ActorContext.WithContext(new ActorItem(actor, inbox, actor.Flags), parent, ProcessId.NoSender, null, msg, () =>
            {
                switch (msg.Tag)
                {
                case Message.TagSpec.Restart:
                    actor.Restart();
                    break;

                case Message.TagSpec.LinkChild:
                    var lc = msg as SystemLinkChildMessage;
                    actor.LinkChild(lc.Child);
                    break;

                case Message.TagSpec.UnlinkChild:
                    var ulc = msg as SystemUnLinkChildMessage;
                    actor.UnlinkChild(ulc.Child);
                    break;
                }
            });
        }