Sun GlassFish Message Queue 4.4 Developer's Guide for C Clients


The MQCloseSession function closes the specified session.

MQCloseSession(MQSessionHandle sessionHandle);

Return Value

MQStatus. See the MQStatusIsError() function for more information.



The handle to the session that you want to close. This handle is created and passed back to you by the MQCreateSession() function.

This handle is invalid after the function returns successfully.

Closing a session closes the resources (producers and consumers) associated with that session and frees up the memory allocated for that session.

There is no need to close the producers or consumers of a closed session.

Common Errors


(If called from a consumer’s message listener in the session.)