MSMQCREATEQUEUE

Creates a queue at a specified MSMQ pathname.

Syntax

CALL MSMQCREATEQUEUE(qid, rc, propids, value1 ,value2, ...>);

Required Arguments

qid
Numeric, output
Returns the queue identifier that represents the format name of the queue that is created. The format name of the queue is a unique name generated by MSMQ.
rc
Numeric, output
Provides the return code from the CALL routine. If an error occurs, then the return code is nonzero. A return code of -1 reflects a SAS internal error. Otherwise, it represents an MSMQ error code. You can use the SAS function SYSMSG() to obtain a textual description of the return code.
propids
Character, input
Specifies one or more properties that the queue exhibits when it is created. This parameter is a character string with each applicable property separated by a comma. PATHNAME is the only required property. You must provide a value parameter for each property specified in the propids string. Each property ID in the propids string is associated positionally with a value parameter.
The following creation properties are valid:
AUTHENTICATE
Specifies whether the queue accepts only authenticated messages. The following values are valid:
NONE (default)
Specifies the queue accepts either authenticated or non-authenticated messages.
ALWAYS
Specifies the queue always requires authenticated messages.
BASEPRIORITY
Specifies a single base priority for all messages that are sent to a public queue. Values range from -32768 to 32767, where 32767 is the highest priority and 0 is the default priority.
JOURNAL
Determines whether messages retrieved from the queue are also copied to its journal queue. The following values are valid:
NONE (default)
Specifies that messages that are removed from the queue are discarded.
ALWAYS
Specifies that messages removed from the queue are always stored in its journal queue.
JOURNAL_QUOTA
Specifies the maximum size (in kilobytes) of the journal queue. The default size is infinite.
LABEL
Describes the queue. The default is a blank label ().
PATHNAME
Specifies the MSMQ pathname of the queue. The format of a public queue is:
MachineName\QueueName
The format of a private queue is:
MachineName\PRIVATE$\QueueName
PRIV_LEVEL
Specifies the privacy level that is required by the queue. The following values are valid:
NONE
Specifies that the queue accepts only non-private (clear) messages.
BODY
Specifies that the queue accepts only private (encrypted) messages.
OPTIONAL (default)
Specifies that the queue accepts both private and non-private messages.
QUOTA
Specifies the maximum size (in kilobytes) of the queue. The default size is infinite.
TRANSACTION
Specifies whether the queue is a transaction queue or a non-transaction queue. The following values are valid:
NONE (default)
Specifies that the queue does not accept transaction operations.
ALWAYS
Specifies that all messages that are sent to the queue must always be done through an MSMQ transaction.
TYPE
Specifies the type of service that is provided by the queue. The value of the TYPE property is a universal unique identifier (UUID) in the form of a character string that represents the binary data.
These defaults can either be changed programmatically by using the MSMQSETQSEC routine or via the MSMQ Explorer interface.

Details

The routine also registers the queue in the MSMQ Information Store (MQIS) for public queues or registers it on the local computer for private queues.
Security of the queue defaults as follows:
  • Owner: process user
  • Group: process group
  • DACL: queue creator, has full control
  • Queue users
    • get queue properties
    • get queue security
    • send messages
These defaults can be changed by using either the MSMQSETQSEC routine or the MSMQ Explorer interface.

Example: Example

This example creates a public queue.
length msg $ 200;
qid=0;
rc=0;
CALL MSMQCREATEQUEUE(qid, rc, "PATHNAME,LABEL", "pcpad\testq", "Test Queue");
if rc ^= 0 then do;
   put 'MSMQCreateQueue: failed';
   msg = sysmsg();
   put msg;
end;
else put 'MSMQCreateQueue: succeeded';