使用限制 : 傳送端與接收端都需要開啟MSMQ功能才能遠端傳送與接收。
WHAT IS MSMQ :
Def one
Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues.
Def two
MSMQ is essentially a messaging protocol that allows applications running on separate servers or processes(s) to communicate in a failsafe manner. A queue is a temporary storage location from which messages can be sent and received reliably. They can be used for communication across heterogeneous networks and between computers which may not always be connected.
Def three
訊息佇列 (也稱為 MSMQ) 是為 Microsoft Windows 建立分散式訊息應用程式的訊息基礎架構和開發工具。針對訊息佇列而開發的應用程式會將訊息傳送到佇列 (也是暫存位置),其中,可在情況允許時將訊息傳送到最後的目的地。此類的應用程式可透過性質相異的網路進行通訊,或是在暫時可能無法與另一台電腦連線的電腦之間傳送訊息。訊息佇列可提供下列好處:
Steps to create MSMQ – Queue manually are as follows:
This will create a new Queue, please refer to the attached document for details. Now we will see how to create it programmatically.
Please note: Namespaces required are: ‘System.Messaging’ for MSMQ and ‘System.Net.Mail' for sending mail using SMTP client. Also MSMQ must be installed on your machine.
交易式與非交易式 queue的差異
差別在於交易式的 queue 在傳送資料到 queue 時,必須經 begin、commit、end 等階段,才會正確進行傳送;非交易式的 queue 只需要 send 就可以傳送。
函式與屬性 | 說明 |
---|---|
Reiceive | 收到資料後刪除佇列 |
Peek | 收到資料後保持資料在佇列 |
重要 : 加入參考 > 組件 > 架構 > system.messaging
發送MSMQ訊息
交易式發送MSMQ訊息
遠端刪除佇列
所有的私有佇列都會被刪除
接收MSMQ訊息