RSC/MP Programming Manual

Application Development
Persistent Applications
/* Send third request to a server. Using no-waited here just to show how */
rc = RscWriteRead ( ulOptions, ulConnect, ulSession, "$XYZ", 1, &sRequest,
sizeof ( sRequest ), NULL, NULL );
if ( rc != RSC_SUCCESS )
RscAbortTransaction ( ulConnect, ulSession );
else
{
uReplySize = sizeof ( sReply );
nIoHandle = RSC_IO_CHECK_ALL ;
do
{
rc = RscIoCheck ( ulConnect, ulSession, &nIoHandle, &sReply, &uReplySize );
} while ( rc == RSC_IO_PENDING );
if ( rc == RSC_TRANSACTION_NOT_ENDED )
{
nServerCode = RscSwapShort ( sReply.nRetcode );
if ( nServerCode == 999 )
RscEndTransaction ( ulConnect, ulSession );
else
RscAbortTransaction ( ulConnect, ulSession );
}
}
}
RscDestroyOptions ( ulOptions );
RscEndSession ( ulConnect, ulSession );
RscDisconnect ( ulConnect );
}
Persistent Applications
You have the option of running the TDP in either persistent or nonpersistent mode. You
specify one of these modes by supplying a primary CPU and a backup CPU in a RUN
statement (persistent mode) or by supplying only a primary CPU (nonpersistent mode).
In persistent mode, upon failure of the primary process, the backup process becomes
available for applications to reconnect to and continue processing.
The following subsections provide information about developing a persistent
application, describe what happens during a primary process failure, and show how to
recover using a backup TDP process.
Developing Persistent Applications
Persistent applications should carry out these tasks:
Save the current transaction context so the transaction can be restarted.
Automatically restart all transactions.
Ensure that all interprocess messages are saved in case they have to be restarted.
Enclose all server requests that cause nonretryable database availability updates
in TMF transactions.
Save all data and state information that makes up a transaction until the entire
transaction is completed. For example, if a transaction results from several screens
of user inp ut, the program should be able to restart the transaction without making
the user re-enter the data from previous screens.
HP NonStop Remote Server Call (RSC/MP) Programming Manual 522360-006
6- 15