asp.net技术内幕的书配源码
源代码在线查看: messagepriorities.aspx
void Page_Load(Object sender , EventArgs e)
{
MessageQueue mqMessages;
Message mqMessage;
if (! MessageQueue.Exists( @".\myQueue" ) ) {
MessageQueue.Create( @".\myQueue" );
}
mqMessages = new MessageQueue( @".\myQueue" );
// Send Message 1
mqMessage = new Message();
mqMessage.Label = "Message 1";
mqMessage.Body = "This is message 1";
mqMessage.Priority = MessagePriority.Normal;
mqMessages.Send( mqMessage ) ;
// Send Message 2
mqMessage = new Message();
mqMessage.Label = "Message 2";
mqMessage.Body = "This is message 2";
mqMessage.Priority = MessagePriority.Lowest;
mqMessages.Send( mqMessage ) ;
// Send Message 3
mqMessage = new Message();
mqMessage.Label = "Message 3";
mqMessage.Body = "This is message 3";
mqMessage.Priority = MessagePriority.Highest;
mqMessages.Send( mqMessage ) ;
}
MessagePriorities.aspx
Messages Sent!