MSMQ - Clear Queue

Declaration

<AMMSMQ ACTION="clear" REMOTEMACHINE="text" QUEUENAME="text" />

See Also

MSMQ - Create Queue | MSMQ - Delete Queue | MSMQ - Retrieve Message | MSMQ - Send Message | MSMQ - Wait for Message

Description

Clears existing messages from the specified queue. The Retrieve Message and 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) system in order for these activities to function properly. MSMQ is bundled with Microsoft Windows 2000, Windows XP (excluding Home Edition), Windows Server 2003, Windows Vista and Windows 7 operating systems, however, they are 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

General Properties

Property

Type

Required

Default

Markup

Description

Local Machine

 

 

 

 

If enabled, specifies that this activity will be performed on the local machine. If this parameter is selected, the Remote Machine parameter is ignored. This parameter is enabled by default.

Remote Machine

Text

No

(Empty)

REMOTEMACHINE="HostName"

If enabled, specifies the host name or IP address of the remote machine that this activity will be performed on. If this parameter is enabled, the Local Machine parameter is ignored.

Message Queue

Text

Yes

(Empty)

QUEUENAME="HostName\QueueName"

The name of the message queue to clear. The message queue name consists of the compute 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 Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

 

Description: This sample code clears a queue named "VMWINVX64\private$\myQueue" on the local machine.

 

<AMMSMQ ACTION="clear" QUEUENAME="VMWINVX64\private$\myQueue" />

 

↑ Top of Page