5-day speed-up of the wcf series -- Use of binding on the next day (2)

Source: Internet
Author: User
Tags msmq

 

Take over the previous chapter. Today, we will talk about the application of MSMQ in practical projects. As we all know, if Order is placed to prevent Order loss, we use Order to pass MSMQ.

The advantages of MSMQ are: inherent asynchronous message transmission and inherent automatic load balancing.

 

Let's take a look at the application of MSMQ in practice.

 

Step 1: Prepare for installation. Install the MSMQ server and check the options.

 

Step 2: Create a class library. Create two files, IOrder. cs and Order. cs. As follows.

 

Step 3: Create the Host Console program and create the App. config file, as shown below.

 

Step 4: In the console program: ①: Create a queue. ②: Enable the service.

 

 

Last step: Create a Console program as the client to test MSMQ. This time, we generate an instance through "channel.

①: Let the Host service Off Line. We can insert 100 orders to check whether msmq responds.

 

Yes, the number of messages is the 100 order information inserted by the Client.

②: This time, I will restart the Host to make the Service end On Line. Let's see how MSMQ reacts.

Yes, when msmqfinds that my wcfhas been opened, the message will also go to my 1.txt file.

 

The project diagram is shown as follows:

Author huangxincheng520

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.