Windows Communication Foundation 中的佇列Queues in Windows Communication Foundation

在本節中的主題將討論 Windows Communication Foundation (WCF) 支援佇列。The topics in this section discuss Windows Communication Foundation (WCF) support for queues. WCF 會提供支援藉由利用 Microsoft Message Queuing (先前稱為 MSMQ) 做為傳輸佇列,並適用於下列案例:WCF provides support for queuing by leveraging Microsoft Message Queuing (previously known as MSMQ) as a transport and enables the following scenarios:

  • 鬆散結合的應用程式。Loosely coupled applications. 傳送應用程式可以傳送訊息至佇列,不需要知道接收應用程式是否可以處理訊息。Sending applications can send messages to queues without needing to know whether the receiving application is available to process the message. 佇列以不依靠接收應用程式可以多快處理訊息的速率,提供允許傳送應用程式傳送訊息至佇列的獨立處理。The queue provides processing independence that allows a sending application to send messages to the queue at a rate that does not depend on how fast the receiving applications can process the messages. 傳送訊息至未與訊息處理緊密結合的佇列時,整體系統可用性會增加。Overall system availability increases when sending messages to a queue is not tightly coupled to message processing.

  • 隔離失敗。Failure isolation. 應用程式傳送或接收訊息至佇列可能失敗,但不會互相影響。Applications sending or receiving messages to a queue can fail without affecting each other. 例如,如果接收應用程式失敗,傳送應用程式可以繼續傳送訊息至佇列。If, for example, the receiving application fails, the sending application can continue to send messages to the queue. 當接收者再次接收時,可以處理來自佇列的訊息。When the receiver is up again, it can process the messages from the queue. 隔離失敗會增加整體系統的可靠性與可用性。Failure isolation increases the overall system reliability and availability.

  • 負載平衡。Load leveling. 傳送應用程式可能會利用訊息讓接收應用程式爆滿。Sending applications can overwhelm receiving applications with messages. 佇列可以管理不相符的訊息產生與消耗率,因此接收者不會爆滿。Queues can manage mismatched message production and consumption rates so that a receiver is not overwhelmed.

  • 中斷操作。Disconnected operations. 當透過高延遲網路或可用性有限的網路進行通訊時 (例如使用行動裝置),傳送、接收和處理操作可能中斷。Sending, receiving, and processing operations can become disconnected when communicating over high-latency networks or limited-availability networks, such as in the case of mobile devices. 佇列能夠使這些操作繼續進行,即使已經與端點中斷連線也是一樣。Queues allow these operations to continue, even when the endpoints are disconnected. 重新建立連線後,佇列會將訊息轉送至接收應用程式。When the connection is reestablished, the queue forwards messages to the receiving application.

若要使用的佇列功能的 WCF 應用程式中,您可以使用其中一個標準繫結,或如果其中一個標準繫結無法滿足您的需求,您可以建立自訂繫結。To use the queues feature in a WCF application, you can use one of the standard bindings, or you can create a custom binding if one of the standard bindings does not satisfy your requirements. 如需相關標準繫結,以及如何選擇其中一個的詳細資訊,請參閱How to:與 WCF 端點交換訊息和訊息佇列應用程式For more information about relevant standard bindings and how to choose one, see How to: Exchange Messages with WCF Endpoints and Message Queuing Applications. 如需建立自訂繫結的詳細資訊,請參閱自訂繫結For more information about creating custom bindings, see Custom Bindings.

本節內容In This Section

佇列概觀Queues Overview
訊息佇列概念的概觀。An overview of message queuing concepts.

WCF 中的佇列Queuing in WCF
WCF 佇列支援的概觀。An overview of WCF queue support.

如何:與 WCF 端點交換佇列訊息How to: Exchange Queued Messages with WCF Endpoints
說明如何使用NetMsmqBindingWCF 用戶端和 WCF 服務之間進行通訊的類別。Explains how to use the NetMsmqBinding class to communicate between a WCF client and WCF service.

如何:Exchange 與 WCF 端點的訊息和訊息佇列應用程式How to: Exchange Messages with WCF Endpoints and Message Queuing Applications
說明如何使用MsmqIntegrationBindingWCF 和訊息佇列應用程式之間進行通訊。Explains how to use the MsmqIntegrationBinding to communicate between WCF and Message Queuing applications.

在工作階段中群組佇列訊息Grouping Queued Messages in a Session
說明如何將佇列中的訊息分組,以協助單一接收應用程式處理相關訊息。Explains how to group messages in a queue to facilitate correlated message processing by a single receiving application.

批次處理異動中的訊息Batching Messages in a Transaction
說明如何批次處理交易中的訊息。Explains how to batch messages in a transaction.

使用無效信件佇列來處理訊息傳輸失敗Using Dead-Letter Queues to Handle Message Transfer Failures
說明如何使用寄不出的信件佇列處理訊息傳送和傳遞失敗,以及如何處理來自寄不出的信件佇列的訊息。Explains how to handle message transfer and delivery failures using dead letter queues and how to process messages from the dead letter queue.

有害訊息處理Poison Message Handling
說明如何處理有害訊息 (超過傳送到接收應用程式的最大嘗試傳遞次數的訊息)。Explains how to handle poison messages (messages that have exceeded the maximum number of delivery attempts to the receiving application).

Windows Vista、Windows Server 2003 和 Windows XP 之間的佇列功能差異Differences in Queuing Features in Windows Vista, Windows Server 2003, and Windows XP
摘要說明在 WCF 佇列功能之間的差異Windows VistaWindows VistaWindows Server 2003Windows Server 2003,和Windows XPWindows XPSummarizes the differences in the WCF queues feature between Windows VistaWindows Vista, Windows Server 2003Windows Server 2003, and Windows XPWindows XP.

使用傳輸安全性來保護訊息的安全Securing Messages Using Transport Security
描述如何使用傳輸安全性來保護佇列訊息的安全。Describes how to use transport security to secure queued messages.

使用訊息安全性來保護訊息的安全Securing Messages Using Message Security
描述如何使用訊息安全性來保護佇列訊息的安全。Describes how to use message security to secure queued messages.

為佇列訊息進行疑難排解Troubleshooting Queued Messaging
說明如何疑難排解常見的佇列問題。Explains how to troubleshoot common queuing problems.

佇列通訊的最佳做法Best Practices for Queued Communication
說明使用 WCF 的最佳做法佇列通訊。Explains best practices for using WCF queued communication.