MSMQ - Purge queue

Declaration

<AMMSMQ ACTIVITY="clear" QUEUE="text" REMOTEMACHINE="text" />

Related Topics   

Description

Clears existing messages from the specified queue. The MSMQ - Retrieve message and MSMQ - Wait for message activities can also be used to remove a message from the queue.

IMPORTANT: MSMQ must be installed on the (local or remote) computer in order for these activities to function properly. MSMQ is bundled with most Microsoft Windows operating systems, however, it is not installed by default. For more details regarding the installation of MSMQ, see MSMQ Installation & Overview.

Practical usage

Removes messages that exist in the specified queue.

Parameters

Queue

Property Type Required Default Markup Description
Local computer --- --- --- --- If enabled, specifies that this activity will be performed on the local computer (enabled by default).
NOTE: This parameter does not contain markup and is only displayed in visual mode for task construction and configuration purposes.
Another computer Text No (Empty)
  • REMOTEMACHINE="CompName"
  • REMOTEMACHINE="xxx.xxx.xxx.xxx"
If enabled, specifies the hostname or IP address of the remote computer that this activity will be performed on. When this parameter is enabled, the Local computer parameter is ignored.
Queue path Text Yes (Empty) QUEUENAME="HostName\QueueName" The name of the message queue to purge. The message queue name consists of the computer name, an optional PRIVATE$ keyword that indicates whether it is a private queue and the name of the queue.
  • Public queue example: ComputerName\QueueName
  • Private queue example: ComputerName\PRIVATE$\QueueName

Description

Error Causes

On Error

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

A simple task that creates a queue, sends message to that queue, waits for the message, retrieves the message and purges the queue.

Copy
<!-- Create variable -->
<AMVARIABLE NAME="theVar" VALUE="" />
<!-- Create private queue -->
<AMMSMQ PRIVATE="YES" NAME="myPrivateQueue" RESULTDATASET="privateQueueData" />
<!-- Send message to queue -->
<AMMSMQ ACTIVITY="send_message" QUEUENAME="vmwinvx64\Private$\myPrivateQueue" MESSAGELABEL="Support" MESSAGEFILE="C:\Users\techsupport\Desktop\cd.txt" />
<!-- Wait for message -->
<AMMSMQ ACTIVITY="wait_message" QUEUE="vmwinvx64\Private$\myPrivateQueue" LABEL="Support" RESULTVARIABLE="theVar" />
<!-- Retrieve message -->
<AMMSMQ ACTIVITY="retrieve_message" QUEUENAME="vmwinvx64\Private$\myPrivateQueue" RESULTDATASET="data" MESSAGEFILE="C:\Users\techsupport\Desktop\rt.txt" OVERWRITEFILE="YES" REMOVEMESSAGE="YES" />
<!-- Purge queue -->
<AMMSMQ ACTIVITY="delete_queue" QUEUENAME="vmwinvx64\Private$\myPrivateQueue" />