basic concepts about MSMQ

本文介绍了MSMQ(Microsoft消息队列)的基本概念和技术特点,包括三种类型:私有队列、公共队列和系统队列。详细阐述了MSMQ的消息内容形式和支持的消息格式,并提供了.NET框架下使用C#进行消息发送和接收的方法示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MSMQ is a technichque through which the processes or computers in distributed systems communicate and exchange data asychrounsely and stablely.

2 the type of MSMQ:
 1.Private MQ
 this kind of MSMQ can only be stored in local host and the messages are transferred among the processes of local host
2. public MQ
 this kind of MSMQ can be delieverd among the destributed system only if the hosts are in the arange of  demain/workgroup. MSMQ can work although the destination-hosts are off-line, cos the Messages are stored in client,  in which there is an backend process to broadcast them. only if the receiving destination are on-line, it may receive  the messages then.
3.System MQ
 this kind of MSMQ is about the system operation special message queues that be encapsulated as Message to broadcast in demain/workgroup. I have not so much ideas about this MSMQ.

3the content of MSMQ:
 1.simple text message
 in the simplest case, the message can be just simple text
2.object message
 the message that is to be sent also can be an object

4 the formatter of MSMQ
1.XML
2.Binary file
note:the client and server must keep the same formatter to send/receive MSMQ,eithor XML or Binary file all.

5 class and operations/methods concerned in .net framework using C#
  1.concerned class: System.Messaging---MessageQuequ, Message
 2.main concerned methods/operations
  1) MessageQuequ.Exists(MSMQ_Name)  
   ---to judge the MSMQ named MSMQ_Name does already exists.if do, return true, else return false;
  2) MessageQueue.Create(MSMQ_Name)
   ---to create a MSMQ named MSMQ_Name, and return the instance of an Message queue.
  3) the formatter of message
   //binary file format
    System.Messaging.Formatter=System.Messaging.BinaryMessageFormatter(new Type[]{message_type});
    //XML format
    System.Messaging.Formatter=System.Messaging.xmlMessageFormatter(new Type[]{message_type});
  3) assume obj_message is an instance about System.Messaging.Message
   //initialize an instance of message
   obj_message=new System.Messaging.Message(message_content)
   //send message
   obj_message.send()
   //receive message syncronousely
   obj_message.receive()
   //receive message asyncronousely
   obj_message.beginreceive()

转载于:https://www.cnblogs.com/Winston/archive/2008/03/31/1130630.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值