Previously wrote an article on MSMQ Message Queuing: WCF Distributed Development Essentials (1): MSMQ Message Queuing, which was also used as a basic article for learning about WCF Message Queuing MSMQ programming. In that article, we introduced the basic concepts of MSMQ Message Queuing, installation, deployment, development, debugging and other related issues. Today we're going to learn WCF distributed development step by step: WCF Services offline operations and Message Queuing MSMQ. Programming with MSMQ Message Queuing services under the WCF framework. Here, I'll give you a demo sample program that uses the WCF MSMQ implementation offline request.
Full-text structure is: "1" MSMQ basic concept "2" WCF Message Queuing MSMQ Advantage "3" WCF Message Queuing MSMQ communication framework "4" Installation Configuration Considerations "5" Sample Code "summary"
"1" the basic concept of MSMQ:
To briefly review the basic concepts of MSMQ, you can refer to WCF Distributed development Prerequisites (1): MSMQ Message Queuing.
MSMQ full name Microsoft Message Queue, which is an asynchronous transmission mode for mutual communication between different applications, can be distributed on the same machine or anywhere in the connected network space by the application of mutual communication. The idea is that the sender of the message puts the information he wants to send into a container (which we call the message), and then saves it to a system public space in the messages queue; local or offsite messaging The receiving program then removes the message sent to it from the queue for processing.
Advantages of the "2" WCF Message Queuing MSMQ:
The benefits of Message Queuing MSMQ: stability, message prioritization, offline capabilities, and security, guaranteed messaging, and reliable fail-safe mechanisms for performing many business processes. Message Queuing is therefore one of the key components for implementing SOA service-oriented architectures. The WCF framework provides the ability to integrate and expand with MSMQ. This is also what WCF explicitly points out in its features. MSMQ supports offline messaging mode and, under the WCF framework, provides call extensions for Internet network queuing Services based on the HTTP bridge. and the integration and expansion of the MSMQ framework make the WCF service a new feature:
"2.1" Availabiliy: Usability. This is an embodiment of MSMQ offline messaging. The client and server side do not need to connect in real time, and then interact with the message. A WCF client can send a request to an offline server, and the service will be requested at the appropriate client after it is online.
"2.2" disjoint: decomposition. Work can be broken down into multiple operations, once into the queue. Improve system availability and throughput.
"2.3" Compensating: compensation. For multiple business transactions, it is possible to provide separate things to provide for the aftermath of failure of other transactions.
"2.4" Load leveling: Load balancing. Overload client requests can be placed in queues, processing at idle time, balancing system throughput and improving performance.
"3" WCF Message Queuing MSMQ communication framework:
WCF uses netmsmqbinding to support Message Queuing communications. When a client invokes a service, the client message is encapsulated as an MSMQ message, and a specific message queue is sent. The server host, running the turntable, initiates the channel listener to detect Message Queuing messages, and if the corresponding message is found, the message is taken from the queue and forwarded to the corresponding service using the Distributor. The specific communication architecture is as follows:
If the host is offline, the message is placed in a queue, waiting for the next time the host is online, to perform the message distribution processing to the specified WCF service.