MSMQ - Send message
Declaration
<AMMSMQ ACTIVITY="send_message" REMOTEMACHINE="text" QUEUE="text" ENABLECACHE="YES/NO" DENYSHAREDMODERECEIVE="YES/NO" ACCESSMODE="" FILE="text" LABEL="text" PRIORITY="text (options)" MESSAGETYPE="text (options)" ENCODING="text (options)" TRANSACTIONALTYPE="text (options)" />
Description
Sends a message to the specified queue located locally or on a remote machine.
Practical usage
Generally used for the purpose of sending a message to the selected queue.
Parameters
Message
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
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. |
Body type | Text (options) | No | Text | NULL | Indicates
whether the message contents should be retrieved as text populated
into a variable or saved to a specific text file. Different parameters
become active depending on which option is selected. The available
options are:
|
File | Text | Yes if message is saved to file | (Empty) | MESSAGEFILE="c:\temp\Message.txt" | The path and file name of the text file in which to save the body of the message. If the file does not exist. It will be created at runtime. This parameter is only available if the Body type parameter is set to File. |
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:
|
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) |
|
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 gather messages from. The 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.
|
Example
- 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.
<!-- 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" />