MSMQ - Send Message

Declaration

<AMMSMQ ACTION="send_message" REMOTEMACHINE="text" QUEUENAME="text" MESSAGELABEL="text" MESSAGETEXT="text" />

See Also

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

Description

Sends a message to the specified queue located locally or on a remote machine.

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

Generally used for the purpose of sending a message to the selected queue.

Parameters

General Properties

Property

Type

Required

Default

Markup

Description

Local Machine

Yes/No

No

Enabled

NULL

If enabled, specifies that this activity will be performed on the local machine. If 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 retrieve message from. 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

Message Label

Text

Yes

(Empty)

LABEL="theCoolMessage"

The label of the message to send. This label can be used in the MSMQ - Wait for Message activity to allow for a specific message to wait for.  

Message Text

Text

No

(Empty)

MESSAGETEXT="The message"

If enabled, specified the text message to send. If this parameter is enabled, the Message File parameter is ignored.

Transactional

Yes/No

No

No

TRANSACTIONAL="YES"

Indicates whether the message to send should be set as transactional. Transactional messages are messages sent within a transaction.

Encoding

Text (options)

No

UTF8

ENCODING="ASCII"

The character encoding method to use. This parameter is only available if the Message Text parameter is enabled. The available options are:

  • UTF8 (Default)

  • UTF7

  • ASCII

Populate variable with message text

Text

No

(Empty)

RESULTVARIABLE="theVar"

Indicates an existing variable in which to populate the contents of the message body. This parameter is only available if the Message Text parameter is enabled.

Message File

Text

No

(Empty)

MESSAGEFILE=

"c:\temp\Message.txt"

If enabled indicates that the message to send should be obtained from the specified text file. If this parameter is enabled, the Message Text parameter is ignored.

Overwrite if exists

Yes/No

No

No

OVERWRITE="YES"

Indicates that if a file with the same name already exists, it will be overwritten with the new message body. This parameter is only available if the Message body type parameter is set to File.

 

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 allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

The On Error tab allows you to determine what the task should do if a particular step encounters an error.

More about On Error properties

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (Example: %myVariable% or %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by clicking the Insert expression/variable button or pressing F2.

More on variables
More on expressions

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 sends a message to queue "vmwinvx64\Private$\myQueue" on the local machine with message label "myMessage".

 

<AMMSMQ ACTION="send_message" QUEUENAME="vmwinvx64\Private$\myQueue" MESSAGELABEL="myMessage" MESSAGETEXT="This is the message. " ENCODING="ASCII" TRANSACTIONAL="YES" />

 

↑ Top of Page