TipcSrvGmdMsgServerDelete delete a message in RTserver after a GMD failure on the connection to RTserver
msg
message for RTserver to delete
TRUE
if deletion of the message from RTserver was successfully initiated, FALSE
otherwise.
If TipcSrvGmdMsgServerDelete fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcSrvGmdMsgServerDelete informs RTserver to delete a message after a GMD failure on the connection to RTserver. TipcSrvGmdMsgServerDelete sends a GMD_DELETE message to RTserver. When RTserver routes a message for GMD, it keeps the message in memory so that it can easily and quickly resend the message to any receiving RTclient that disconnects and reconnects. TipcSrvGmdMsgServerDelete informs RTserver to terminate GMD for the message, which allows RTserver to reclaim the memory for the message.
TipcSrvGmdMsgServerDelete is intended to be used from a GMD_FAILURE connection process callback to terminate GMD for the message. See TipcSrvGmdMsgDelete for more information on deleting messages when GMD failures occur.
When a GMD_FAILURE message is processed by a sender RTclient, one of two scenarios is possible:
The standard callback TipcCbSrvProcessGmdFailure uses TipcSrvGmdMsgServerDelete to delete failed messages. See TipcCbConnProcessGmdFailure and TipcCbSrvProcessGmdFailure for more information on processing GMD_FAILURE messages.
Use TipcSrvGmdMsgServerDelete only from a GMD_FAILURE
process callback.
TipcSrvGmdMsgServerDelete sends a GMD_DELETE message to RTserver, but does not explicitly flush the message. See TipcSrvGetAutoFlushSize for more information on message buffering.
TipcCbConnProcessGmdFailure, TipcCbSrvProcessGmdFailure, TipcConnGmdMsgDelete, TipcSrvGmdMsgStatus
This example creates a connection process callback for GMD_FAILURE messages which takes corrective actions to recover from the GMD failure. If recovery succeeds, then the message is resent, otherwise the message is deleted in the sender and in RTserver. The existing callbacks TipcCbConnProcessGmdFailure and TipcCbSrvProcessGmdFailure are destroyed so as to not interfere with the new callback:
void T_ENTRY my_gmd_failure_cb(conn, data, arg) T_IPC_CONN conn; T_IPC_CONN_PROCESS_CB_DATA data; T_CB_ARG arg;/* not used */
{ T_IPC_MSG failed_msg; T_STR failed_proc_name; T_INT4 err_num; T_REAL8 send_time;/* go to the first field of the GMD_FAILURE message */
if (!TipcMsgSetCurrent(data->msg, 0)) {return
; /* error */
}/* read the fields of the GMD_FAILURE message */
if (!TipcMsgNextMsg(data->msg, &failed_msg) || !TipcMsgNextStr(data->msg, &failed_proc_name) || !TipcMsgNextInt4(data->msg, &err_num) || !TipcMsgNextReal8(data->msg, &send_time)) {return
; /* error */
}/* at this point, a sender would typically take some */
/* application-specific corrective action before resending */
/* the message */
if (take_corrective_actions(failed_proc_name, err_num, send_time)) {/* resend the message with GMD */
if (!TipcSrvMsgSend(failed_msg, TRUE)) {return
; /* error */
} } else {/* delete the message in the sender (this process) */
if (!TipcSrvGmdMsgDelete(failed_msg)) {return
; /* error */
}/* delete the message in RTserver */
if (!TipcSrvGmdMsgServerDelete(failed_msg)) {return
; /* error */
} } }/* my_gmd_failure_cb */
/* =========================================================== */
/*...code from calling function is below */
T_IPC_MT mt; T_CB cb; mt = TipcMtLookupByNum(T_MT_GMD_FAILURE); if (mt == NULL) {return
; /* error */
}/* create connection process callback for GMD_FAILURE messages */
if (TipcSrvProcessCbCreate(mt, my_gmd_failure_cb, NULL) == NULL) {return
; /* error */
}/* destroy standard callbacks for GMD_FAILURE messages */
cb = TipcSrvProcessCbLookup(mt, TipcCbConnProcessGmdFailure, NULL); if (cb == NULL) {return
; /* error */
} if (!TutCbDestroy(cb)) {return
; /* error */
} cb = TipcSrvProcessCbLookup(mt, TipcCbSrvProcessGmdFailure, NULL); if (cb == NULL) {return
; /* error */
} if (!TutCbDestroy(cb)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |