3.1.7.1.3 Create Queue

This event MUST be generated with the following arguments:

Return Values:

  • rStatus: A status code that indicates success or failure.

  • rQueue: A reference to the Queue ADM element instance that was created.

The queue manager MUST perform the following actions to process this event:

  • If the Pathname ADM attribute of the Queue ADM element instance referenced by iQueue does not contain a valid queue path name as defined in [MS-MQMQ] section 2.1.1, set rStatus to an error value, and take no further action.

  • Instantiate a new Queue ADM element instance, referred to as newQueue.

  • Set newQueue.JournalQueueReference to NULL. If iQueue.Pathname does not represent a subqueue, as specified in [MS-MQMQ] section 2.1.1:

    • Create a new Queue ADM element instance referred to as newJournalQueue to act as the queue journal

    • Set newQueue.JournalQueueReference to the created newJournalQueue.

  • Copy each ADM attribute of the Queue ADM element instance referenced by iQueue that is listed in the following table to the corresponding ADM attribute of the Queue ADM element instance referenced by newQueue.

    ADM attribute

    Label

    Type

    Pathname

    Journaling

    Quota

    JournalQuota

    Authentication

    PrivacyLevel

    Transactional

    MulticastAddress

    Security

    BasePriority

  • Set the other ADM attributes of the Queue ADM element instance referenced by newQueue to the values shown in the following table.

    ADM attribute

    Value

    QueueManager

    Set to a reference to LocalQueueManager.

    Active

    False

    TotalBytes

    zero

    QueueType

    If newQueue.Pathname is of the form used for a private queue, as defined in [MS-MQMQ] section 2.1.1, set to Private; if newQueue.Pathname is of the form used for a system queue, as defined in [MS-MQMQ] section 2.1.1, set to System; otherwise, set to Public.

    SubqueueCollection

    empty

    IncomingTransactionalTransferInfoCollection

    empty

    MessagePositionList

    empty

    OpenQueueDescriptorCollection

    empty

    CreateTime

    The current time.

    ModifyTime

    The current time.

    QualifiedPathname

    Constructed from newQueue.Pathname by replacing the computer name with the fully-qualified computer name.

    Scope

    Enterprise

    PrivateQueueNumber

    If newQueue.QueueType is Private, set to an integer that is not in the set of all PrivateQueueNumber ADM attribute values of the Queue ADM element instances in LocalQueueManager.QueueCollection that have QueueType ADM attribute values of Private.

    FullPath

    empty string

    DirectoryPath

    empty string

  • If the Queue ADM element instance referenced by newQueue is of type PublicQueue and the iSkipDirectory argument is set to False:

    • Generate a Create Directory Object (section 3.1.7.1.18) event with the following argument:

      • iDirectoryObject := newQueue

    • If the Create Directory Object event returns an rStatus that indicates success:

      • Set newQueue.Identifier to the GUID returned in rObjectGUID.

    • Generate a Read Directory (section 3.1.7.1.20) event with the following arguments:

      • iDirectoryObjectType := "Queue"

      • iFilter := an array consisting of one attribute-filter expression, "Identifier" EQUALS newQueue.Identifier

      • iAttributeList := a list consisting of two ADM attribute names, FullPath and DirectoryPath

    • If the Read Directory (section 3.1.7.1.20) event returns an rStatus that indicates success, set newQueue.FullPath to rDirectoryObject.FullPath and newQueue.DirectoryPath to rDirectoryObject.DirectoryPath.

    • Else:

      • Return the Create Directory Object event rStatus as the rStatus for this event, and take no further action.

  • Add the Queue ADM element instance referenced by newQueue to the QueueCollection ADM attribute of the QueueManager (section 3.1.1.1) ADM element instance referenced by LocalQueueManager.

  • Return a reference to the Queue ADM element instance referenced by newQueue and an rStatus that indicates success.