MessageQueue
The MessageQueue component provides access to a queue on a Message Queuing server. Applications can communicate across networks and systems to send, receive, or read (peek) messages from queues. A path to an existing resource can be set in the MessageQueue, or a new queue can be created.
The MessageQueue component supports synchronous and asynchronous message retrieval. Synchronous methods, Peek and Receive delay the process for a specified time for a new message to arrive in the queue. Asynchronous methods, BeginPeek and BeginReceive, allow the main application tasks to continue separately until a message arrives in the queue. Both methods work by using callback objects and state objects to communicate information.
Before you can call Send(Object), Peek, or Receive, you must associate the new instance of the MessageQueue class with an existing queue. At that point, you can manipulate the queue properties such as Category and Label.
Note: Message Queuing is an optional component of Windows 2000 and Windows NT and must be installed separately. You can enable and install Message Queuing as follows:
Enable Message Queueing
In the Windows® Control Panel,
-
Select Programs and then Turn Windows features on or off to open the Windows Features form.
-
Scroll down to the Microsoft Message Queue (MSMQ) Server options and select all of the check boxes under the entry to enable Message Queueing.
Note: Selecting the top level Microsoft Message Queue (MSMQ) Server check box does not enable all of the features. Ensure you select each check box individually.
-
Click OK
The installation process will begin and you will be prompted to restart your computer when the process is complete.
-
Restart as required to complete the Message Queueing installation.
Note: You may need to start the MSMQ service in the Windows® Task Manager, if it is not set to run at startup.
Properties
The key properties for the MessageQueue component include:
-
DefaultPropertiesToSend. Specifies the property values to be used by default when the application sends messages to the queue.
-
EnableConnectionCache. Specifies whether a cache of connections will be maintained by the application.
-
MaximumQueueSize. Specifies the maximum size of the queue.
-
WriteHandle. Specifies the native handle used to send messages to the message queue.
Events
Key events associated with a MessageQueue control include:
-
ReceiveCompleted. Occurs when a message has been received and removed from the queue.
For information on configuring events and other components of the design using a script, see: Working with Scripts.
More information on the MessageQueue component can be viewed at the link to Microsoft® Documentation.