`

Introduction to MSMQ

阅读更多

What is MSMQ?

Microsoft Message Queuing, or MSMQ, is technology for asynchronous messaging. Whenever there's need for two or more applications (processes) to send messages to each other without having to immediately know results, MSMQ can be used. MSMQ can communicate between remote machines, even over internet. It's free and comes with Windows, but is not installed by default.

Typical usage

Typical example of MSMQ usage would be order processing application: orders are collected online using web forms and by sales team using some offline application. Order processing is slow, because third party payment provider is used. Third party resource can be unavailable at times and we don't want that failure to affect our application - we can delay processing of pending orders, but new orders must be collected.

Notification web page should be immediately displayed to user, even if that order is processed hours later. Sales must collect orders offline and send them to processing later, when connection with order processing server is available. After payment is processed it should be enough just to send message that shipment should be sent, and not wait for delivery to be completed. MSMQ is ideal for these kind of scenarios - when applications should be isolated and work even if other applications they interact with are down or unavailable.

From programming point of view, MSMQ is very easy - applications just need to send and receive messages, MSMQ will take care of message delivery, wait until recipient is available, etc. MSMQ supports transactions, if processing fails for any reason message can be returned back to queue to be retried later. Distributed transactions with database operations are supported too, if COM+ is used.

Alternative to MSMQ

Another approach to isolate applications could be to use some shared resource, like database. First application would write there data for processing. Another application would have to periodically check if there's something new, and process it. Beside inefficiency of pinging database constantly, this approach requires much more work - some protocol must be created to know if message (i.e. row) is pending or processed. However this is tip of an iceberg - MSMQ offers much more: messages can have different priority, limited life time, notification of success or failure can be delivered, processed messages can be stored in journal, etc. All this functionality would have to be reinvented.

When things go wrong

So far one of main reasons not to use MSMQ was lack of tools that could help when things go wrong. And they do go wrong. Most notorious problem are poison messages - when some message can not be processed and blocks entire queue. If we implement manual messaging using database every situation could be solved by manual database modifications.

If MSMQ is used messages and queues are in proprietary format which cannot be edited directly. Only available management tool is MMC administration console (or MqExplorer in earlier versions). If it can't do what you need you're out of luck - you have to write some code that accesses MSMQ API directly. Problem is even simplest operations like deleting or copying messages are not available from MMC!

Fortunately with tool like QueueExplorer troubleshooting becomes much easier - all commonly used operations are available from explorer-like interface.

分享到:
评论

相关推荐

    msmq消息队列相关

    **MSMQ消息队列详解** MSMQ,全称为Microsoft Message Queuing,是微软提供的一种异步通信技术。它允许应用程序在不可用的网络环境中发送消息,确保数据的可靠传输,即使接收方暂时离线也能正常工作。MSMQ的核心...

    一个封装MSMQ操作的类.zip_MSMQ C++_VC msmq_msmq_msmq c_vc ms

    MSMQ,全称为Microsoft Message Queuing,是微软提供的一种可靠的消息队列技术,它允许应用程序在不可靠的网络环境中进行通信。在这个压缩包文件中,包含的是一个使用C++编写的MSMQ操作类的示例,它已经被封装好,...

    msmq.rar_java msmq_java 消息队列_java消息队列_msmq_消息队列

    Java MSMQ(Message Queuing)是Java编程中用于实现异步通信的一种技术,它基于微软的MSMQ(Microsoft Message Queue)服务。在分布式系统中,消息队列扮演着至关重要的角色,因为它允许不同组件之间解耦,使得系统...

    MSMQ C++ API 例子

    MSMQ,全称为Microsoft Message Queuing,是一种由微软提供的可靠且异步的消息传递技术。它允许应用程序在不直接通信的情况下交换消息,特别是在网络不稳定或目标系统不可用时,能够存储并转发消息,确保数据传输的...

    C#MSMQ 消息队列工具

    **C# MSMQ 消息队列工具详解** 在IT领域,消息队列(Message Queue,简称MQ)是一种常用于应用程序之间异步通信的技术。MSMQ(Microsoft Message Queuing)是微软公司提供的一种消息队列服务,它允许分布式系统中的...

    Msmq自用-请勿下载

    ** MSMQ 概述 ** MSMQ,全称为Microsoft Message Queuing,是微软提供的一种消息队列技术。它允许应用程序在不可靠的网络环境中可靠地交换数据,即使发送方和接收方之间的通信暂时中断,消息也能被存储并稍后传递。...

    无法启动MSMQ服务

    ### 无法启动MSMQ服务的知识点详解 #### 一、MSMQ简介 消息队列服务(Message Queuing Service,简称MSMQ)是Microsoft提供的一种消息传递技术,它允许应用程序跨网络进行可靠的消息发送与接收。MSMQ支持异步通信...

    NET中MSMQ完整教程+Msmq.PerfermanceTest

    .NET中的MSMQ(Message Queuing)是微软提供的一种可靠的消息传递技术,用于应用程序之间的异步通信。本教程全面涵盖了MSMQ的关键概念和技术,包括它的设计原理、安装与配置、编程接口以及性能测试。 首先,MSMQ是...

    MSMQ__Demo

    **MSMQ 概述** MSMQ,全称为 Microsoft Message Queuing,是微软提供的一种消息队列技术,用于在分布式系统中可靠地传递消息。MSMQ 使得应用程序可以在网络不稳定或者目标系统不可用的情况下,仍然能够发送和接收...

    Java通过MsmqJava读写MSMQ源码及例子

    Java通过MsmqJava读写MSMQ是一种在Java应用程序中利用消息队列(MSMQ)技术的方法。MSMQ,全称Microsoft Message Queuing,是由微软提供的一个可靠的消息传递服务,用于在不同网络环境、应用程序之间或者在不可靠的...

    MSMQ实例源码 C#

    MSMQ(Microsoft Message Queuing)是微软提供的一种异步消息传递技术,用于在分布式系统中进行可靠的信息交换。它允许应用程序之间通过消息队列进行通信,即使这些应用程序在网络不稳定或者暂时不可用的情况下也能...

    msmq消息队列相关demo

    MSMQ,全称为Microsoft Message Queuing,是微软提供的一种异步通信技术,它允许应用程序在不同时刻通过网络进行通信,即使发送方和接收方在通信时不在线也能完成消息传递。这种技术对于构建可靠且容错的分布式系统...

    远程访问消息队列、MSMQ

    消息队列(Message Queuing,简称MSMQ)是微软提供的一种企业级的异步通信技术,它允许应用程序在不直接连接的情况下发送和接收消息。在远程访问消息队列的场景中,这一技术尤为重要,因为它可以跨越网络障碍,即使...

    MSMQ项目总结.rar

    MSMQ项目总结示例代码 MSMQ项目总结\MSMQ数据库数据传输.rar MSMQ项目总结\MSMQ基类.rar MSMQ项目总结\MQ事务性消息传输.rar MSMQ项目总结\MSMQ单线程监控.rar MSMQ项目总结\MSMQ文件发送接收.rar MSMQ项目总结\MSMQ...

    简单的MSMQ程序仅供学习

    MSMQ,全称为Microsoft Message Queuing,是微软提供的一种异步消息传递技术,主要用于在不同应用程序之间或在不可靠的网络环境中可靠地传递消息。它允许应用程序在无法立即响应的情况下发送消息,例如当接收方不...

    MSMQ客户端

    MSMQ(Microsoft Message Queuing)是微软提供的一种消息队列技术,主要用于在分布式系统中实现可靠的消息传递。作为MSMQ客户端,它允许应用程序通过发送和接收消息与其他MSMQ服务器或客户端进行通信,即使目标系统...

    MSMQ使用总结(事务性、线程监控、文件发送接收和远程信息交互)

    **MSMQ(Microsoft Message Queuing)是微软提供的一种消息队列技术,主要用于应用程序之间的异步通信。在本文中,我们将深入探讨MSMQ的核心特性,包括事务性消息传输、单线程监控、文件发送与接收以及远程信息交互...

    简单的msmq例子

    MSMQ,全称为Microsoft Message Queuing,是微软提供的一种异步消息传递技术。它允许应用程序在不同时刻发送和接收消息,即使发送方和接收方不在同一时间在线也能正常工作。这种技术对于处理网络不稳定、应用程序...

    MSMQ开发范例

    **MSMQ(Microsoft Message Queuing)开发范例详解** MSMQ,全称为Microsoft Message Queuing,是微软提供的一种异步消息传递技术。它允许应用程序在不可靠或延迟的网络环境中可靠地交换信息,通过将消息放入队列来...

    MSMQ消息队列演示程序

    **MSMQ消息队列演示程序**是一个在Visual Studio 2005环境下使用C#编写的实例,旨在帮助初学者理解和应用消息队列(Message Queuing,简称MSMQ)技术。该程序包含了完整的源代码,以及一个封装好的类,使得消息的...

Global site tag (gtag.js) - Google Analytics