DeliveryStatus 列舉

定義

當訊息的傳遞不確定,或是當訊息未傳遞時,指定訊息傳遞狀態的列舉。An enumeration that specifies the delivery status of a message when the delivery of the message is in doubt, or when the message was not delivered.

public enum class DeliveryStatus
public enum DeliveryStatus
type DeliveryStatus = 
Public Enum DeliveryStatus
繼承
DeliveryStatus

欄位

InDoubt 0

訊息的傳遞不確定。The delivery of the message is in doubt.

NotDelivered 1

未傳遞訊息。The message was not delivered.

範例

下列範例說明如何存取服務作業內訊息的 DeliveryStatusThe following example shows how to access the DeliveryStatus of a message within a service operation.

public void SimpleSubmitPurchaseOrder(PurchaseOrder po)
{
    Console.WriteLine("Submitting purchase order did not succeed ", po);
    MsmqMessageProperty mqProp = OperationContext.Current.IncomingMessageProperties[MsmqMessageProperty.Name] as MsmqMessageProperty;

    Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus);
    Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure);
    Console.WriteLine();
}
<OperationBehavior(TransactionScopeRequired := True, TransactionAutoComplete := True)> _
Public Sub SimpleSubmitPurchaseOrder(ByVal po As PurchaseOrder)
    Console.WriteLine("Submitting purchase order did not succeed ", po)
    Dim mqProp As MsmqMessageProperty = TryCast(OperationContext.Current.IncomingMessageProperties(MsmqMessageProperty.Name), MsmqMessageProperty)

    Console.WriteLine("Message Delivery Status: {0} ", mqProp.DeliveryStatus)
    Console.WriteLine("Message Delivery Failure: {0}", mqProp.DeliveryFailure)
    Console.WriteLine()
End Sub

備註

傳送給佇列的訊息可能會到達寄不出的信件佇列,這是因為該訊息未傳遞或是佇列管理員不確定傳遞結果。A message sent to a queue can land in a dead-letter queue because the message was not delivered or the Queue Manager is not sure of the delivery outcome. 當從寄不出的信件佇列讀取訊息時, DeliveryStatus 就是取得訊息傳遞狀態的一個方式。The DeliveryStatus is a way to get the status of message delivery when the message is read from a dead-letter queue.

適用於