Msmq4SubqueuePoisonHandler.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Channels / Msmq4SubqueuePoisonHandler.cs / 1 / Msmq4SubqueuePoisonHandler.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Channels
{ 
    using System.Collections.Generic;
    using System.IO; 
    using System.Threading; 
    using System.Transactions;
 
    sealed class Msmq4SubqueuePoisonHandler : IPoisonHandlingStrategy
    {
        MsmqReceiveHelper receiver;
 
        public Msmq4SubqueuePoisonHandler(MsmqReceiveHelper receiver)
        { 
            this.receiver = receiver; 
        }
 
        public void Open()
        {}

        public bool CheckAndHandlePoisonMessage(MsmqMessageProperty messageProperty) 
        {
            if (messageProperty.AbortCount > this.receiver.MsmqReceiveParameters.ReceiveRetryCount) 
            { 
                FinalDisposition(messageProperty);
                return true; 
            }
            else
            {
                return false; 
            }
        } 
 
        public void FinalDisposition(MsmqMessageProperty messageProperty)
        { 
            switch (this.receiver.MsmqReceiveParameters.ReceiveErrorHandling)
            {
                case ReceiveErrorHandling.Drop:
                    this.receiver.DropOrRejectReceivedMessage(messageProperty, false); 
                    break;
 
                case ReceiveErrorHandling.Fault: 
                    MsmqReceiveHelper.TryAbortTransactionCurrent();
                    if (null != this.receiver.ChannelListener) 
                        this.receiver.ChannelListener.FaultListener();
                    if (null != this.receiver.Channel)
                        this.receiver.Channel.FaultChannel();
                    break; 
                case ReceiveErrorHandling.Reject:
                    this.receiver.DropOrRejectReceivedMessage(messageProperty, true); 
                    MsmqDiagnostics.PoisonMessageRejected(messageProperty.MessageId, this.receiver.InstanceId); 
                    break;
                default: 
                    DiagnosticUtility.DebugAssert("System.ServiceModel.Channels.Msmq4PoisonHandler.FinalDisposition(): (unexpected ReceiveErrorHandling)");
                    break;
            }
        } 

        public void Dispose() 
        {} 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK