TipcSrvConnGmdMsgServerDelete


Name

TipcSrvConnGmdMsgServerDelete — delete a message in RTserver after a GMD failure

Synopsis

T_BOOL TipcSrvConnGmdMsgServerDelete(srv, msg) 
T_IPC_SRV srv; 
T_IPC_MSG msg; 

Arguments

srv — connection handle to RTserver

msg — message for RTserver to delete

Return Values

TRUE if deletion of the message from RTserver was successfully initiated, FALSE otherwise.

Diagnostics

If TipcSrvConnGmdMsgServerDelete fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TipcSrvConnGmdMsgServerDelete informs RTserver to delete a message after a GMD failure on the connection to RTserver. TipcSrvConnGmdMsgServerDelete 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. TipcSrvConnGmdMsgServerDelete informs RTserver to terminate GMD for the message, which allows RTserver to reclaim the memory for the message.

TipcSrvConnGmdMsgServerDelete is intended to be used from a GMD_FAILURE connection process callback to terminate GMD for the message. See TipcSrvConnGmdMsgDelete 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 TipcSrvConnGmdMsgServerDelete to delete failed messages. See TipcCbConnProcessGmdFailure and TipcCbSrvProcessGmdFailure for more information on processing GMD_FAILURE messages.

Caution

Use TipcSrvConnGmdMsgServerDelete only from a GMD_FAILURE process callback.

TipcSrvConnGmdMsgServerDelete sends a GMD_DELETE message to RTserver, but does not explicitly flush the message. See TipcSrvConnGetAutoFlushSize for more information on message buffering.

See Also

TipcCbConnProcessGmdFailure, TipcCbSrvProcessGmdFailure, TipcConnGmdMsgDelete, TipcSrvConnGmdMsgStatus

Examples

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 they do 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; 
{ 
  T_IPC_SRV srv = arg; 
  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 (!TipcSrvConnMsgSend(srv, failed_msg, TRUE)) { 
      return;  /* error */ 
    } 
  } 
  else { 
    /* delete the message in the sender (this process) */ 
    if (!TipcSrvConnGmdMsgDelete(srv, failed_msg)) { 
      return;  /* error */ 
    } 
 
    /* delete the message in RTserver */ 
    if (!TipcSrvConnGmdMsgServerDelete(srv, 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 (TipcSrvConnProcessCbCreate(srv, mt, my_gmd_failure_cb,  
                               srv) == NULL) { 
  return;  /* error */ 
} 
 
/* destroy standard callbacks for GMD_FAILURE messages */ 
 
cb = TipcSrvConnProcessCbLookup(srv, mt, 
TipcCbConnProcessGmdFailure, 
                                NULL); 
if (cb == NULL) { 
  return;  /* error */ 
} 
 
if (!TutCbDestroy(cb)) { 
  return;  /* error */ 
} 
 
cb = TipcSrvConnProcessCbLookup(srv, 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