TipcSrvGmdMsgStatus poll RTserver for GMD status of a message
msg
message to poll RTserver about
TRUE
if the poll for GMD status was successfully initiated, FALSE
otherwise.
If TipcSrvGmdMsgStatus fails, it returns FALSE
and sets the global SmartSockets error number to one of:
TipcSrvGmdMsgStatus polls for the GMD status of msg
by sending a GMD_STATUS_CALL message to RTserver. RTserver responds by sending back a GMD_STATUS_RESULT message. The response should come back very quickly. The polling RTclient can use functions such as TipcSrvMsgSearchType to get the response.
When RTserver routes a message for GMD, it keeps track of which RTclients should receive the message and the status of GMD to each of these RTclients. TipcSrvGmdMsgStatus is intended to be used from a GMD_FAILURE connection process callback to query GMD status for the message.
The GMD_STATUS_RESULT message contains four fields:
If RTserver does not have an in-memory GMD record of msg
, RTserver silently ignores the GMD_STATUS_CALL message and no GMD_STATUS_RESULT message is returned. This indicates that one of these has happened:
When a GMD_FAILURE message is processed by a sender RTclient, one of two scenarios is possible:
See TipcCbConnProcessGmdFailure and TipcCbSrvProcessGmdFailure for more information on processing GMD_FAILURE messages.
TipcSrvGmdMsgStatus is usually only used from a GMD_FAILURE process callback, but it can be called at any time by advanced applications which wish to poll for GMD status.
TipcSrvGmdMsgStatus sends a GMD_STATUS_CALL message to RTserver, but does not explicitly flush the message. See TipcSrvGetAutoFlushSize for more information on message buffering.
TipcCbConnProcessGmdFailure, TipcCbSrvProcessGmdFailure, TipcConnGmdMsgDelete, TipcSrvGmdMsgServerDelete
This example creates a connection process callback for GMD_FAILURE messages which uses TipcSrvGmdMsgStatus to poll RTserver for GMD status. (This example callback simply prints the GMD status information. A real callback would take some corrective actions to recover from the GMD failure.)
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_IPC_MT mt; T_IPC_MSG result_msg; T_INT4 seq_num; T_STR *success_client_names; T_INT4 num_success_client_names; T_STR *failure_client_names; T_INT4 num_failure_client_names; T_STR *pending_client_names; T_INT4 num_pending_client_names; T_INT4 counter;/* loop counter */
/* go to the first field of the GMD_FAILURE message */
if (!TipcMsgSetCurrent(data->msg, 0)) {return
; /* error */
}/* read the first field of the GMD_FAILURE message, which is */
/* the message where GMD failed */
if (!TipcMsgNextMsg(data->msg, &failed_msg)) {return
; /* error */
}/* poll RTserver for GMD status information */
if (!TipcSrvGmdMsgStatus(failed_msg)) {return
; /* error */
} mt = TipcMtLookupByNum(T_MT_GMD_STATUS_RESULT); if (mt == NULL) {return
; /* error */
}/* wait a short time for the GMD status result */
result_msg = TipcSrvMsgSearchType(10.0, mt); if (result_msg == NULL) {return
; /* error */
}/* must set current field first */
if (!TipcMsgSetCurrent(result_msg, 0)) {return
; /* error */
}/* get the fields from the message */
if (!TipcMsgRead(result_msg, T_IPC_FT_INT4, &seq_num, T_IPC_FT_STR_ARRAY, &success_client_names, &num_success_client_names, T_IPC_FT_STR_ARRAY, &failure_client_names, &num_failure_client_names, T_IPC_FT_STR_ARRAY, &pending_client_names, &num_pending_client_names, NULL)) {return
; /* error */
} TutOut("Got GMD_STATUS poll result.\n"); TutOut("seq_num = %d\n", seq_num); TutOut("success_client_names\n"); for (counter = 0; counter < num_success_client_names; counter++) { TutOut(" %s\n", success_client_names[counter]); } TutOut("failure_client_names\n"); for (counter = 0; counter < num_failure_client_names; counter++) { TutOut(" %s\n", failure_client_names[counter]); } TutOut("pending_client_names\n"); for (counter = 0; counter < num_pending_client_names; counter++) { TutOut(" %s\n", pending_client_names[counter]); } if (!TipcMsgDestroy(result_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 */
cb = TipcSrvProcessCbCreate(mt, my_gmd_failure_cb, NULL); if (cb == NULL) {return
; /* error */
}/* raise priority of callback so it is called before */
/* TipcCbSrvProcessGmdFailure, which uses */
/* TipcSrvGmdMsgServerDelete to tell RTserver to forget */
/* the message */
if (!TutCbSetPriority(cb, 2)) {return
; /* error */
}
TIBCO SmartSockets™ Application Programming Interface Software Release 6.8, July 2006 Copyright © TIBCO Software Inc. All rights reserved www.tibco.com |