Message Queuing (MSMQ)

Message Queuing (MSMQ) technology enables applications running at different times to communicate across heterogeneous(多种多样的) networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues. The following illustration shows how a queue can hold messages that are generated by multiple sending applications and read by multiple receiving applications.

Where Applicable

Message Queuing provides guaranteed message delivery, efficient routing(有效路径), security, and priority-based messaging.

It can be used to implement solutions to both asynchronous and synchronous scenarios requiring high performance. The following list shows several places where Message Queuing can be used.

  • Mission-critical(关键任务) financial services: for example, electronic commerce(电子商务).

  • Embedded and hand-held(便携式) applications: for example, underlying communications to and from embedded devices that route baggage through airports by means of an automatic baggage system.

  • Outside sales: for example, sales automation applications for traveling sales representatives.

  • Workflow: Message Queuing makes it easy to create a workflow that updates each system. A typical design pattern is to implement an agent to interact with each system. Using a workflow-agent architecture also minimizes the impact of changes in one system on the other systems. With Message Queuing, the loose coupling between systems makes upgrading individual systems simpler.

Developer Audience

Message Queuing applications can be developed using C++ APIs or COM objects. Applications can be built in any of the popular development environments: for example, Microsoft® Visual Basic®, Visual Basic® Scripting Edition, Visual C++®, Visual Studio® .NET, Borland Delphi, and Powersoft Powerbuilder. This allows applications to be developed for the Internet as well, including both server-side (Internet Information Server) and client-side (Internet Explorer) applications. The .NET Framework offers a set of managed Message Queuing objects.

Run-Time Requirements

MSMQ 1.0 can be deployed on computers running Microsoft® Windows NT® 4.0, Windows® 95, and Windows 98.

MSMQ 2.0 can be deployed on computers running Microsoft Windows 2000.

MSMQ 3.0 can be deployed on computers running Microsoft Windows XP Professional and members of the Windows Server 2003 family.

MSMQ is also available with independent client functionality on computers running Windows CE 3.0.

Interoperability (互用性,协同工作的能力)

With the MSMQ-MQSeries Bridge, a connector application available in Microsoft Host Integration Server 2000, Message Queuing can be used to communicate with IBM MQSeries systems. For more information about the support for interoperability with other messaging systems using the MSMQ-MQSeries Bridge, see Message Queuing Connector Services

 

Message Queuing Overview

Message Queuing is a message infrastructure(基础设施) and a development platform for creating distributed, loosely-coupled messaging applications for the Microsoft® Windows® operating system. Message Queuing applications can use the Message Queuing infrastructure to communicate across heterogeneous networks and with computers that may be offline. Message Queuing provides guaranteed message delivery, efficient routing, security, transaction support, and priority-based messaging.

This overview covers the types of Message Queuing applications that can be written and the types of Message Queuing environments within which these applications can operate. (For information and procedures on deploying the Message Queuing infrastructure, see the Message Queuing online Help.)

 

Message Queuing applications can be divided into two categories: sending applications, which send messages to queues, and receiving applications, which read messages in queues and can remove messages from queues.

 

Sending Applications

Sending applications send messages to a queue, not to the receiving application. Using a queue as the destination allows the sending application to operate independently of the receiving application.

Developers have several options to consider when designing sending applications:

  • Transactional messages versus nontransactional messages. Sending a transactional message can be included with other operations—such as updating a database or sending one or more other transactional messages—in an atomic process that can be aborted if any part of the transaction fails. Transactional messages guarantee exactly-once and in-order delivery. Conversely, nontransactional messages cannot guarantee exactly-once or in-order delivery.

  • Express delivery(快递) versus recoverability. A message may be routed through several computers before it reaches its destination. Recoverable messages can be delivered even if one of these computers crashes. This is because a copy of the message is stored locally on disk on the sending computer and on every computer that forwards the message during routing until the message is delivered to the next computer. After delivery to the destination queue, recoverable messages are stored on disk in memory-mapped files(内存映射文件) until they are received. Express messages, on the other hand, are stored only in volatile memory on the sending computer, during routing, and after delivery to the destination queue. As a result, if the computer where the message resides crashes or reboots, the message is not available when the computer restarts. Similarly, an express message delivered to a queue on a virtual server in a cluster will be lost if the virtual server fails over before the message is received.

  • Direct routing versus store-and-forward routing. Direct messages are sent directly to the computer where the destination queue resides and do not access the directory service. Store-and-forward routing requires a connection to the directory service, and the path that the message takes is determined by Message Queuing.

  • Sending messages to a single destination versus multiple destinations. Message Queuing supports both sending messages to a single destination and sending messages to multiple destinations. MSMQ 3.0 provides support for sending messages to multiple destinations in the form of distribution lists, multiple-element format names, and multicast addresses.

  • Authenticated messages versus non-authenticated messages. Authenticated messages are digitally signed and authenticated by Message Queuing. When a message is authenticated, Message Queuing guarantees that no one has tampered with(干扰) the message, and it verifies the identity of the sender.

  • Encrypted messages versus non-encrypted messages. Encrypted messages are encrypted before they leave the source computer to after the time when they reach the target computer. Information in non-encrypted messages can be read while the message is on the wire.

  • Online versus offline operations. When online, the sending application has access to information stored in the directory service. When operating offline, the sending application cannot make any calls that require access to the directory service.

Receiving applications

Receiving applications read the messages in the queue in two different ways. The receiving application can peek at a message in the queue, leaving the message in the queue, or it can retrieve the message, taking the message out of the queue.

Developers should consider the following when designing their receiving applications:

  • Local versus remote read. Messages should always be read locally. Reading messages remotely consumes a lot of resources.

  • Transactional versus nontransactional messages. The retrieval of a transactional message can be combined with other operations—such as retrieving one or more other transactional messages, sending one or more other messages, or updating a database—within a single transaction that can be aborted if any action in the transaction fails.

  • Synchronous versus asynchronous reading. The asynchronous reading of messages allows the receiving operation to continue its processing while it waits for the messages to be read from the queue. The synchronous reading of messages blocks processing until the messages are read from the queue or a time-out expires.

  • Peek versus retrieve. Peeking at message allows the receiving application to look at the message and leave a copy of the message in the queue. Retrieving messages from the queue removes the messages from the queue.

  • Online versus offline operations. When online, the receiving application has access to information stored in the directory service. When operating offline, the receiving application cannot make any calls that require access to the directory service.

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值