首页 > 学院 > 开发设计 > 正文

Asp.Net中的消息处理---MSMQ系列学习(一)

2019-11-17 02:12:52
字体:
来源:转载
供稿:网友
asp.net中的消息处理---MSMQ系列学习(一)

刚刚毕业一年,比较浮躁,上次面试被问到消息队列,觉得非常的惭愧因为不知道,所以下定决心一定要学会使用它。以前只是听说过有这么个东西,要说是什么,在什么场景下使用却是无从知晓,因为自己也确实没有在项目中用过,毫无底气能够去和面试官谈论一番。好了现在就开始一步步学习吧!

首先我们要知道消息队列是什么? 我是被网络上的解释忽悠的一愣一愣的,来个个人通俗的解释吧,消息队列顾名思义它首先得是个队列,队列的操作呢一班主要的也就是入队和出队,也就是你有一个程序在产生消息内容后(也就是你想发送的内容,比如一个字符串,一本书等等),也就是入队(即生产者),另一个程序呢读取消息队列,读出你发送进入的消息内容,这就是出队(消费者);那么这样的情况一般我们会在什么情况下去使用消息队列呢?总结大神的一句话:当你不需要立即获得结果,但是并发量又不能无限大的时候,差不多就是你需要使用消息队列的时候.比如你写日志的时候,一个客户端有多个操作区写日志,又有很多个客户端去写,显然并发不能无穷大,于是你就需要把写日志的请求放入消息队列中,在消费者那边依次取出队列的消息写入到日志里。

一.MSMQ的安装

关于MSMQ的介绍我就不多说了,想知道的自己百度,http://www.oschina.net/translate/top-10-uses-for-message-queue

具体的安装过程就是 控制面板->卸载程序->打开或者关闭Windows功能,选择MSMQ,如下图,点击确定即可;

PRiiLFinehwDxBEECJHiDB26AuIHBNTMA5sbc931199xdv/ePmm7UdM8MBiDEgSj083n4DAvVdXfVt39VXSUJISQgDEASAggBBEVgd95PEKEgQoF8gjhAjghCUY4YBgATBYgCRArFG8qH/KsYnLYAgJ/Dx4H/GyDSH+HijX3KRBdChCMMEADwADgALACaFMgjMOSGbhO06jJ3ZuLXJyMNUv+lEd/FIe+FQU/tgLt2wF074Drf7zrf7zqXz/l+1/l+9/l+9zkRZ/tcZ0h6eZxnekT0Ok8XoyfHQQefHg4+FhGu0z2u070c+L+8+6dB76fOqR7n8uGTB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