Esempio n. 1
0
        public int AbortEvents <T>()
            where T : EventBase
        {
            var type  = typeof(T);
            var count = WriteQueue.RemoveAll(e => e.GetType() == type);

            Log.Trace("Aborted {0} events of type {1}", count, type.Name);
            return(count);
        }
        /// <summary>
        /// Removes all pending messages of type T.  Messages cannot be removed
        /// after the queue has begun to process.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>
        /// The number of messages removed.
        /// </returns>
        public int RemoveMessages <T>()
            where T : Message
        {
            var type   = typeof(T);
            var result = WriteQueue.RemoveAll(m => m.GetType() == type);

            Log.VerboseFmtIf(result > 0,
                             "{0} aborted {1} {2} messages", Parent.FullName, result, type.Name);
            return(result);
        }