How Do I...Control a message queue?
Message queuing makes it easy for application developers to
communicate with application programs quickly and reliably by
sending and receiving messages. Messaging provides you with
guaranteed message delivery and a robust, fail-safe way to
carry out many of your business processes.
The MessageQueue component allows you to easily incorporate message-based
communication into your applications. Using this component and its associated
language features, you can send and receive messages, explore existing queues,
create and delete queues, and perform a variety of other operations using a
simple programming model.
This sample illustrates how to change some properties of a message queue. It is a
small console application that can be run from a command prompt. Run the sample
without any command-line arguments and it will print its full usage
instructions.
For example, if you want change a queue's label, run:
> MQCtrl.exe MyQueue l "New Label"
In its simplest form, changing a property of a message queue involves:
- Creating a new instance of a MessageQueue component and pointing it to an existing queue:
MessageQueue mq = new MessageQueue(mqPath);
C#
|
- Setting the property to a new value:
Example
C# MQCtrl.exe
[This sample can be found at M:\web\users\sites\AspnetQuickStart\v2.0\QuickStart\howto\samples\Services\MessageQueue\MQCtrl\
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild
passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin
directory.]
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2005 Microsoft Corporation. All rights reserved.
|