Exemplo n.º 1
0
 public ActorDropDowns(IStrategyFactory factory, ActorConventionState convention, ActorSystemState system)
 {
     _convention = convention;
     _system     = system;
     _factory    = factory;
 }
Exemplo n.º 2
0
 private static Unit ObserveState(ActorSystemState state, ObserveStateMessage msg) =>
     state.ObserveState(msg.ProcessId);
Exemplo n.º 3
0
 public Actor()
 {
     Me     = new ActorParticipant();
     System = new ActorSystemState();
 }
Exemplo n.º 4
0
 private static ActorSystemState ShutdownProcess(ActorSystemState state, ShutdownProcessMessage msg) =>
     state = state.ShutdownProcess(msg.ProcessId);
Exemplo n.º 5
0
 private static Unit ObservePub(ActorSystemState state, ObservePubMessage msg) =>
     state.ObservePub(msg.ProcessId, msg.MsgType);
Exemplo n.º 6
0
 private static void Reply(ActorSystemState state, ReplyMessage msg) =>
     state.Reply(msg.ReplyTo, msg.Message, msg.Sender, msg.RequestId);
Exemplo n.º 7
0
 private static Unit GetChildren(ActorSystemState state, GetChildrenMessage msg) =>
     state.GetChildren(msg.ProcessId);
Exemplo n.º 8
0
 private static Unit ShutdownAll(ActorSystemState state) =>
     state.Shutdown();
Exemplo n.º 9
0
        public static ActorSystemState Inbox(ActorSystemState state, object msg)
        {
            try
            {
                if (msg is ActorSystemMessage)
                {
                    logInfo(msg);

                    var rmsg = msg as ActorSystemMessage;
                    switch (rmsg.Tag)
                    {
                        case ActorSystemMessageTag.Startup:
                            state = state.Startup();
                            break;

                        case ActorSystemMessageTag.AddToStore: 
                            state = AddToStore(state, rmsg as AddToStoreMessage);
                            break;

                        case ActorSystemMessageTag.RemoveFromStore:
                            state = RemoveFromStore(state, rmsg as RemoveFromStoreMessage);
                            break;

                        case ActorSystemMessageTag.Tell:
                        case ActorSystemMessageTag.TellSystem:
                        case ActorSystemMessageTag.TellUserControl:
                            Tell(state, rmsg as TellMessage);
                            break;

                        case ActorSystemMessageTag.ShutdownProcess:
                            ShutdownProcess(state, rmsg as ShutdownProcessMessage);
                            break;

                        case ActorSystemMessageTag.ShutdownAll:
                            ShutdownAll(state);
                            break;

                        case ActorSystemMessageTag.GetChildren:
                            GetChildren(state, rmsg as GetChildrenMessage);
                            break;

                        case ActorSystemMessageTag.Publish:
                            Publish(state, rmsg as PubMessage);
                            break;

                        case ActorSystemMessageTag.Reply:
                            Reply(state, rmsg as ReplyMessage);
                            break;

                        case ActorSystemMessageTag.ObservePub:
                            ObservePub(state, rmsg as ObservePubMessage);
                            break;

                        case ActorSystemMessageTag.ObserveState:
                            ObserveState(state, rmsg as ObserveStateMessage);
                            break;
                    }
                }
                else if (msg is SystemMessage)
                {
                    state.TellSystem(msg as SystemMessage, state.Root);
                }
                else if (msg is UserControlMessage)
                {
                    state.TellUserControl(msg as UserControlMessage, state.Root);
                }
                else
                {
                    publish(msg);
                }
            }

            catch (Exception e)
            {
                logSysErr(e);
            }
            return state;
        }
Exemplo n.º 10
0
 private static ActorSystemState Tell(ActorSystemState state, TellMessage msg)
 {
     state.Tell(msg.ProcessId, msg.Sender, msg.Tag, msg.Message);
     return state;
 }
Exemplo n.º 11
0
 private static ActorSystemState RemoveFromStore(ActorSystemState state, RemoveFromStoreMessage msg) =>
     state.RemoveFromStore(msg.ProcessId);
Exemplo n.º 12
0
 private static ActorSystemState AddToStore(ActorSystemState state, AddToStoreMessage msg) =>
     state.AddOrUpdateStoreAndStartup(msg.Process, msg.Inbox, msg.Flags);
Exemplo n.º 13
0
 private static Unit Publish(ActorSystemState state, PubMessage msg) =>
     state.Publish(msg.ProcessId, msg.Message);
Exemplo n.º 14
0
 public static ActorSystemState Inbox(ActorSystemState state, Unit msg)
 {
     return state;
 }