示例#1
0
        protected void ConfirmDelivery()
        {
            if (!IsCurrentMessageConfirmable)
            {
                Log.Warning("Attempted to confirm non-confirmable message {0}." +
                            Environment.NewLine + "{1} needs to implement the IConfirmableMessage interface or be wrapped in a " +
                            "ConfirmableMessageEnvelope in order to be de-duplicated by this actor." + Environment.NewLine
                            + "Please see https://devops.petabridge.com/articles/msgdelivery/deduplication.html#iconfirmablemessages for more information.",
                            Context.AsInstanceOf <ActorCell>().CurrentMessage, Context.AsInstanceOf <ActorCell>().CurrentMessage.GetType());
                return;
            }

            Debug.Assert(CurrentConfirmationId != null, nameof(CurrentConfirmationId) + " != null");
            _receiverState = _receiverState.ConfirmProcessing(CurrentConfirmationId.Value, CurrentSenderId);


            // Persist the current confirmation state
            Persist(new Confirmation(CurrentConfirmationId.Value, CurrentSenderId), confirmation =>
            {
                if (LastSequenceNr % Settings.TakeSnapshotEveryNMessages == 0)
                {
                    SaveSnapshot(_receiverState.ToSnapshot());
                }
            });
        }
示例#2
0
        protected void ConfirmDelivery()
        {
            if (!IsCurrentMessageConfirmable)
            {
                Log.Warning("Attempted to confirm non-confirmable message {0}",
                            Context.AsInstanceOf <ActorCell>().CurrentMessage);
                return;
            }

            Debug.Assert(CurrentConfirmationId != null, nameof(CurrentConfirmationId) + " != null");
            _receiverState = _receiverState.ConfirmProcessing(CurrentConfirmationId.Value, CurrentSenderId);


            // Persist the current confirmation state
            Persist(new Confirmation(CurrentConfirmationId.Value, CurrentSenderId), confirmation =>
            {
                if (LastSequenceNr % Settings.TakeSnapshotEveryNMessages == 0)
                {
                    SaveSnapshot(_receiverState.ToSnapshot());
                }
            });
        }