Esempio n. 1
0
        /// <summary>
        /// If snapshot from <see cref="GetDeliverySnapshot"/> was saved, it will be received during recovery phase in a
        /// <see cref="SnapshotOffer"/> message and should be set with this method.
        /// </summary>
        /// <param name="snapshot"></param>
        public void SetDeliverySnapshot(GuaranteedDeliverySnapshot snapshot)
        {
            _deliverySequenceNr = snapshot.DeliveryId;
            var now = DateTime.Now;
            var unconfirmedDeliveries = snapshot.UnconfirmedDeliveries
                                        .Select(u => new KeyValuePair <long, Delivery>(u.DeliveryId, new Delivery(u.Destination, u.Message, now, 0)));

            _unconfirmed = new ConcurrentDictionary <long, Delivery>(unconfirmedDeliveries);
        }
        /// <summary>
        /// If snapshot from <see cref="GetDeliverySnapshot"/> was saved, it will be received during recovery phase in a
        /// <see cref="SnapshotOffer"/> meesage and should be set with this method.
        /// </summary>
        /// <param name="snapshot"></param>
        public void SetDeliverySnapshot(GuaranteedDeliverySnapshot snapshot)
        {
            _deliverySequenceNr = snapshot.DeliveryId;
            var now = DateTime.Now;
            var unconfirmedDeliveries = snapshot.UnconfirmedDeliveries
                .Select(u => new KeyValuePair<long, Delivery>(u.DeliveryId, new Delivery(u.Destination, u.Message, now, 0)));

            _unconfirmed = new ConcurrentDictionary<long, Delivery>(unconfirmedDeliveries);
        }