Sun Java System Message Queue 4.3 Developer's Guide for C Clients


The MQCreateXASession function creates a distributed transaction (XA) session on an XA connection, defines its behavior, and passes back a handle to the session.

MQCreateXASession(const MQConnectionHandle connectionHandle,
                 MQReceiveMode receiveMode
                 MQMessageListenerBAFunc     beforeMessageListener,
                 MQMessageListenerBAFunc     afterMessageListener,
                 void *                      callbackData,
                 MQSessionHandle * sessionHandle);

Return Value

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



The handle to the connection to which this session belongs. This handle is passed back to you by the MQGetXAConnection function. You can create multiple sessions on a single connection.


An enumeration specifying whether this session will do synchronous or asynchronous message receives. Specify MQ_SESSION_SYNC_RECEIVE or MQ_SESSION_ASYNC_RECEIVE.

If the session is only for producing messages, the receiveMode has no significance. In that case, specify MQ_SESSION_SYNC_RECEIVE to optimize the session’s resource use.


A callback function before asynchronous message delivery.


A callback function after asynchronous message delivery.


A data pointer to be passed to the beforeDelivery and afterDelivery functions.


A handle to this session. You will need to pass this handle to the functions you use to manage the session and to create destinations, consumers, and producers associated with this session.

If receiveMode is MQ_SESSION_SYNC_RECEIVE, pass NULL for beforeMessageListener, afterMessageListener, and callbackData.

The MQCreateXASession function creates a new distributed transaction (XA) session. The connectionHandle must be a XA connection handle.

An XA session is the same as a regular session created by MQCreateSession (see MQCreateSession) except:

Common Errors