Exemplo n.º 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:
                tell(ActorContext.DeadLetters, DeadLetter.create(sender, pid, e, "Process error: ", message));
                return(InboxDirective.Default);
            }
        }