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
VB MQCtrl.exe
[This sample can be found at C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\QuickStart\howto\samples\Services\MessageQueue\MQCtrl\]
Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright 2004 Microsoft Corporation. All rights reserved.
|