MSMQ - Send message

 

Declaration

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

Related Topics   

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) 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

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

Parameters

General

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

Error Causes

On Error

Example

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

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" />