tibems_SetAllowCloseInCallback

Function

Purpose

Set whether client applications can close sessions or connections, or stop connections, inside message listener callbacks.

C Declaration

tibems_status tibems_SetAllowCloseInCallback(
    tibems_bool allow);

COBOL Call

CALL "tibems_SetAllowCloseInCallback",
 USING BY VALUE isAllowed,
       RETURNING tibems-status
END-CALL.

Parameters

Parameter Description
allow When true, the application will proceed without waiting for the message callbacks to return before closing a session or a connection or before stopping a connection. When false, the application will get a TIBEMS_ILLEGAL_STATE error status.

By default, the application gets a TIBEMS_ILLEGAL_STATE status.

Remarks

This function can be used to change the default EMS client behavior and set whether the client application can call the tibemsSession_Close, tibemsConnection_Close or tibemsConnection_Stop functions from the tibemsMsgCallback.

Note: According to the JMS 2.0 specification, calling any of these functions is not allowed and must return an error. If calling them inside the callback is allowed, then these functions when called inside the callback do not return an error and will proceed without waiting for the same callback to return.

The default behavior is to return with a TIBEMS_ILLEGAL_STATE status and parallel the behavior specified in the JMS 2.0 specification, which the EMS client API adheres to. However, this function allows applications to override the default behavior and close or stop EMS objects inside message callbacks.