As discussed in Handling GMD Failures, recovery from GMD_FAILURE messages is very application-specific, and thus SmartSockets cannot provide a generic solution on its own. For example, when processing a GMD_FAILURE message, the sender could cancel a transaction by sending another message to all the RTclients that did receive the message. RTclient recovery can be more complicated because each message sent is routed to all RTclients subscribing to the destination subject. However, through the use of the monitoring capabilities described in Chapter 5, Project Monitoring, a sending RTclient can easily probe the state of the project and make recovery decisions based on the monitoring information. In any case, it is essential that the reason for the failure be ascertained by either the application or the administrator before the message is re-sent. Re-sending the message before the cause of the failure is fixed will only compound the failure.
In addition to the GMD_FAILURE connection process callback TipcCbConnProcessGmdFailure that is created for all connections, RTclient’s connection to RTserver by default has a process callback for GMD_FAILURE message that uses TipcCbSrvProcessGmdFailure as the callback function. TipcCbSrvProcessGmdFailure calls TipcSrvGmdMsgServerDelete to terminate GMD in RTserver for the failed message.
TipcCbSrvProcessGmdFailure is intended as a sample callback that is designed only to reclaim memory in RTserver when GMD fails. More sophisticated programs should create their own process callbacks for GMD_FAILURE messages to perform actions such as user-defined recovery procedures. See the reference page for TipcCbSrvProcessGmdFailure in the TIBCO SmartSockets Application Programming Interface reference for full details on this callback.
From a GMD_FAILURE process callback, the function TipcSrvGmdMsgServerDelete can be used to notify RTserver to terminate GMD for a specific message. For example:
From a GMD_FAILURE process callback, the function TipcSrvGmdMsgStatus can be used to query RTserver for the GMD status of a specific message. For example:
if (!TipcSrvGmdMsgStatus(msg)) {/* error */
}/* wait up to 10 seconds for RTserver to respond */
mt = TipcMtLookupByNum(T_MT_GMD_STATUS_RESULT); if (mt == NULL) {/* error */
} status_msg = TipcSrvMsgSearchType(10.0, mt); if (status_msg == NULL) {/* error */
}/* access fields from msg and make recovery decisions */
TIBCO SmartSockets™ User’s Guide Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |