Example #1
0
        InboxDirective RunMessageDirective(
            ProcessId pid,
            ProcessId sender,
            StrategyDecision decision,
            Exception e,
            object message
            )
        {
            var directive = decision.MessageDirective;

            switch (directive.Type)
            {
            case MessageDirectiveType.ForwardToParent:
                tell(pid.Parent, message, sender);
                return(InboxDirective.Default);

            case MessageDirectiveType.ForwardToSelf:
                tell(pid, message, sender);
                return(InboxDirective.Default);

            case MessageDirectiveType.ForwardToProcess:
                tell((directive as ForwardToProcess).ProcessId, message, sender);
                return(InboxDirective.Default);

            case MessageDirectiveType.StayInQueue:
                return(InboxDirective.PushToFrontOfQueue);

            default:
                if (!(e is ProcessKillException))
                {
                    tell(sys.DeadLetters, DeadLetter.create(sender, pid, e, "Process error: ", message));
                }
                return(InboxDirective.Default);
            }
        }
Example #2
0
        void RunProcessDirective(
            ProcessId pid,
            ProcessId sender,
            Exception e,
            object message,
            StrategyDecision decision,
            bool unPauseAfterRestart
            )
        {
            var directive = decision.ProcessDirective;

            // Find out the processes that this strategy affects and apply
            foreach (var cpid in decision.Affects.Filter(x => x != pid))
            {
                switch (directive.Type)
                {
                case DirectiveType.Escalate:
                case DirectiveType.Resume:
                    // Note: unpause probably won't do anything if unPauseAfterRestart==false because our strategy did not pause them (but unpause should not harm)
                    unpause(cpid);
                    break;

                case DirectiveType.Restart:
                    restart(cpid);
                    break;

                case DirectiveType.Stop:
                    kill(cpid);
                    break;
                }
            }

            switch (directive.Type)
            {
            case DirectiveType.Escalate:
                tellSystem(Parent.Actor.Id, SystemMessage.ChildFaulted(pid, sender, e, message), Self);
                break;

            case DirectiveType.Resume:
                // Note: unpause should not be necessary if unPauseAfterRestart==false because our strategy did not pause before (but unpause should not harm)
                unpause(pid);
                break;

            case DirectiveType.Restart:
                Restart(unPauseAfterRestart);
                break;

            case DirectiveType.Stop:
                ShutdownProcess(false);
                break;
            }
        }
Example #3
0
        void RunProcessDirective(
            ProcessId pid,
            ProcessId sender,
            Exception e,
            object message,
            StrategyDecision decision
            )
        {
            var directive = decision.ProcessDirective;

            // Find out the processes that this strategy affects and apply
            foreach (var cpid in decision.Affects.Filter(x => x != pid))
            {
                switch (directive.Type)
                {
                case DirectiveType.Escalate:
                case DirectiveType.Resume:
                    unpause(cpid);
                    break;

                case DirectiveType.Restart:
                    restart(cpid);
                    break;

                case DirectiveType.Stop:
                    kill(cpid);
                    break;
                }
            }

            unpause(pid);

            switch (directive.Type)
            {
            case DirectiveType.Escalate:
                tellSystem(Parent.Actor.Id, SystemMessage.ChildFaulted(pid, sender, e, message), Self);
                break;

            case DirectiveType.Resume:
                // Do nothing
                break;

            case DirectiveType.Restart:
                Restart();
                break;

            case DirectiveType.Stop:
                ShutdownProcess(false);
                break;
            }
        }