Original: WCF Series 5-day crash-the second day of binding use (2)
To undertake the previous chapter, today, the application of MSMQ in actual combat projects. As we all know, to prevent the loss of orders, we are using order over MSMQ.
The benefits of MSMQ are personally considered: innate asynchronous message sending and natural automatic load balancing.
Well, look at the application of MSMQ in combat.
The first step: Prepare, install the MSMQ server, and then tick the option to install.
Step Two: Create a new Class library. Established two file Iorder.cs,order.cs. As follows.
Step Three: Create the console program for the host and build the app. Config file as follows.
Fourth step: In the console program: ①: Create queue. ②: Turn on the service.
The last step: Create a new console program as a client to test MSMQ, this time we generate the instance through "channel".
①: Let the host service off line, we insert 100 order to see how MSMQ reacts.
Yes, the number of messages is the 100 order information that my client inserted.
②: This time, I'll reboot host and let the service end on line. See what happens with MSMQ.
Yes, when MSMQ discovers that my WCF is turned on, the message is all in my "1.txt" file.
Finally, the project diagram is presented:
WCF Series 5-day crash-the second day of binding use (2)