3.2.4.3 Session Close
If the MSMQ Session policy assertion described in section 2.2.3.2 is set, the initiator MUST deliver the envelope records together as one MSMQ Message by performing the following:
If rMsmqMessage is not equal to NULL:
Construct an end record, referred to as rEndRecord, using the logic described in section 3.2.4.5 of [MC-NMF].
Set rNetMsmqMessage.EndRecord equal to rEndRecord.
Set rMsmqMessage.Body to rNetMsmqMessage.
Raise the Enqueue Message event from section 3.1.7.1.9 of [MS-MQDMPR] with the following parameters:
iQueue set to rSendQueue, the opened queue from section 3.2.4.1.
iMessage set to rMsmqMessage.
iTransaction set to rTransaction.
If the returned rStatus is not equal to MQ_OK (0x00000000), then an error MUST be propagated to the higher layer, and no further processing done.
The initiator MUST also close the queue by performing the following:
Raise the Close Queue event from section 3.1.7.1.6 of [MS-MQDMPR], with the following parameters:
iQueueDesc set to rSendQueue.
If the returned rStatus, is not equal to MQ_OK (0x00000000), then an error MUST be propagated to the higher layer, and no further processing done.