Exemplo n.º 1
0
        /// <summary>
        /// Concludes tracking for the message whose <see cref="ReceiptMsg" /> is passed.
        /// </summary>
        /// <param name="msg">The received receipt message.</param>
        /// <remarks>
        /// This method is called by the associated <see cref="MsgRouter" /> instance
        /// whenever it receives a <see cref="ReceiptMsg" />.  Note that this method
        /// will call the router's <see cref="MsgRouter.OnDeadRouterDetected" /> method
        /// if a track is still active for the original message and the receipt message
        /// indicates a delivery failure.
        /// </remarks>
        public void OnReceiptMsg(ReceiptMsg msg)
        {
            MsgTrack track;

            using (TimedLock.Lock(router.SyncRoot))
            {
                if (!msgTracks.TryGetValue(msg.ReceiptID, out track))
                {
                    return;
                }

                msgTracks.Remove(msg.ReceiptID);
            }
        }
Exemplo n.º 2
0
        public void Msg_Clone_ReceiptMsg()
        {
            ReceiptMsg msgIn, msgOut;

            Msg.ClearTypes();
            Msg.LoadTypes(Assembly.GetExecutingAssembly());

            msgOut = new ReceiptMsg(Helper.NewGuid());
            msgIn  = (ReceiptMsg)msgOut.Clone();

            Assert.IsNotNull(msgIn);
            Assert.AreEqual(msgOut.ReceiptID, msgIn.ReceiptID);

            TestBaseCloning(msgOut);
        }
Exemplo n.º 3
0
        public void Msg_Serialize_ReceiptMsg()
        {
            ReceiptMsg     msgIn, msgOut;
            EnhancedStream es = new EnhancedMemoryStream();

            Msg.ClearTypes();
            Msg.LoadTypes(Assembly.GetExecutingAssembly());

            msgOut = new ReceiptMsg(Helper.NewGuid());

            Msg.Save(es, msgOut);
            es.Seek(0, SeekOrigin.Begin);
            msgIn = (ReceiptMsg)Msg.Load(es);

            Assert.IsNotNull(msgIn);
            Assert.AreEqual(msgOut.ReceiptID, msgIn.ReceiptID);
        }