MSMQ - Create queue
Declaration
<AMMSMQ PRIVATE="YES/NO" TRANSACTIONAL="YES/NO" NAME="text" RESULTDATASET="text" REMOTEMACHINE="text/>
Description
Creates a public or private queue on the local remote computer based on the queue properties provided and populates a dataset with information about the newly created queue.
Practical usage
Creates a message queue in order to perform subsequent MSMQ transactions.
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) |
|
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. |
Name | Text | Yes | (Empty) | QUEUENAME="CompName\QueueName" | The
name of the message queue to create. 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.
|
Private | Yes/No | No | No | PRIVATE="YES" | If selected, specifies that the newly created queue should be set as private. A private queue is a queue registered on the local machine (not in the directory service) that typically cannot be located by other applications. Private queues have the advantage of no directory service overhead (no latency, and no replication), and they can be created and deleted when the directory service is not working. This parameter is disabled by default and available only if the Local computer parameter is enabled. |
Transactional | Yes/No | No | No | TRANSACTIONAL="YES" | If selected, specifies that the newly created queue should be set as transactional. Transactional queues can only contain transactional messages, which are messages sent within a transaction. This parameter is disabled by default. |
Create and populate dataset with queue information | Text | Yes | (Empty) | RESULTDATASET="theQueueInfo" | The dataset name to be created and populated with information regarding the newly created queue. More information regarding this parameter and related dataset fields can be found below under Datasets. |
Additional notes
Datasets
A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields. The table below describes these fields (assuming the dataset name assigned was theDataset).
Name | Type | Return Value |
---|---|---|
theDataset.QueuePath | Text | Returns the path to the newly created queue. |
theDataset.ID | Text | Returns the unique ID for 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
This simple task creates a queue, sends a message to that queue, waits for the message, retrieves the message and purges the queue. Step by step details are embedded in the task.
<!-- 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" />