SAS IT技术(与MSMQ交互)

MSMQ 简介

MSMQMicrosoft Message Queuing Service的缩写,及微软消息队列服务。MSMQ技术提供了一种基于消息和队列的松散耦合并且十分可靠的应用程序的模型。目前Windows 2000Windows XP以及Windows NT都支持MSMQ

MSMQ使用异步通讯技术来进行消息的发送和接受。因此,要了解MSMQ技术首先必须先要了解异步通讯合同步通讯的概念。同步通讯,比如打电话,消息的发送和接受是实时的,消息的发送方在做其他任务之前必须等待接受方做出响应,发送方等待的时间取决于接受方处理的时间和网络的速度。而异步通讯,比如发送Email、文档打印,消息的发送方在对接受方做出请求之后,可以立即进行其它任务,而不管接受方是否已经做出处理或响应,至于接受方做出响应后,发送方如何以及何时处理则由发送方决定。

如果运行在同一台计算机或者不同计算机的应用程序间需要进行异步通讯的话,MSMQ是一个很好的选择,它可以保证消息可靠的发送和接受。MSMQ的消息可以支持各种数据类型,既可以使各种基本的数据类型如字符、数字等,也可以使用户自定义的数据类型。消息的格式可以是XML格式,也可以是二进制格式,或者ActiveX消息格式。此外,MSMQ还支持事务性处理。

SAS与MSMQ交互,SAS网站原文如下:

Contents MSMQ Interface Previous Next

Writing MSMQ Applications

With MSMQ messaging, two or more applications communicate with each other indirectly and asynchronously using message queues. The applications do not have to be running at the same time or even in the same operating environment. An application wishing to communicate with another application simply sends a message to a queue. The receiving application retrieves the message when it is ready.

A typical SAS program using MSMQ services performs the following tasks:

  1. A program must first either open an existing queue or create a new queue. A function is available to help find queues based on their property values. If opening an existing queue, the program supplies a queue identifier to select the appropriate queue. If creating a new queue, a queue identifier is returned to the program to be used in subsequent calls. The queue identifier is used by MSMQ in a distributed database that maintains information about users, queues, queue managers, host machines, and network layout. This database is referred to as the MSMQ Information Store (MQIS) and helps to insulate the application developer from the details of the network.
  2. When creating a queue, you can declare it public or private. Public queues are registered in the MQIS and can be accessed throughout the network. Private queues, on the other hand, can be accessed only by systems that know the queue's full path name or format name. Other properties can be set when creating a queue such as security, message handling, and types of services provided by the queue. These same types of properties can also be retrieved from or set on a queue that has been opened.
  3. A program that has opened a queue can compose and send a message. To compose a message, a function is used to identify a data map which describes the format, the number and the type of parameters to be sent as part of the message. The data map is used by a function that creates a data descriptor of the actual values of the SAS variables to be included in the message. If your distributed application uses a Microsoft Transaction Server (MTS), a transaction object can be used to send the message based on the success of the transaction.
  4. A program can also retrieve messages from an opened queue. MSMQ uses the concept of a cursor to identify the location of the message within a queue. A message can be read from the current cursor location or you can peek at the next location. When a message is read, the program can elect to remove the message or leave it on the queue. In addition, a number of message properties such as security issues, size, identification, and statistics on the delivery can also be retrieved.
  5. After a program has sent or retrieved all its messages, queues can also be closed or deleted. This releases the resources allocated when the queue was opened or created.

Note: MSMQ uses several different representations to identify a queue, such as format name, pathname, instance GUID, and queue handle. There are functions available that you can use to convert between representations.


Contents MSMQ Interface Previous Next

<script language=Javascript src="/lib/itvsasid.js"></script>  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值