private void OnSchedulerMessage(ISchedulerMessage message)
        {
            switch (message)
            {
            case FutureMessage _ when this._queue.Count == this._maxQueuedMessages:
                if (this.IsRecovering)
                {
                    throw new InvalidOperationException("The size of the queue is smaller than the snapshot. This can happen if you changed the config of the queue to be smaller than at the moment of snapshot.");
                }

                // Cannot process message when scheduler is full, reply to sender.
                Sender.Tell(SchedulerFull.Instance, this.Self);
                break;

            case FutureMessage fm:
                this.OnFutureMessage(fm);
                break;

            case RecallMessage rm:
                this.OnRecallMessage(rm);
                break;

            case UpdateFireTimeAbsolute ua:
                this.OnUpdateFireTimeAbsolute(ua);
                break;

            case UpdateFireTimeRelative ur:
                this.OnUpdateFireTimeRelative(ur);
                break;

            default:
                throw new ArgumentException($"Invalid scheduler message type: '{message.GetType()}'", nameof(message));
            }
        }
示例#2
0
        private void OnSchedulerMessage(ISchedulerMessage message, IActorRef sender)
        {
            var isRecovering = this.IsRecovering;

            this._messageManagerRef.Ask <Ack>(message)
            .ContinueWith(x =>
            {
                this._acknowledgementStrategy.OnAcknowledge(x.Result, message, sender, isRecovering);
            },
                          System.Threading.Tasks.TaskContinuationOptions.OnlyOnRanToCompletion)
            .ContinueWith(x =>
            {
                this._acknowledgementStrategy.OnAcknowledgeFailed(x.Exception, message, sender, isRecovering);
            },
                          System.Threading.Tasks.TaskContinuationOptions.NotOnRanToCompletion)
            .ConfigureAwait(false);
        }