1.3 Oracle Tuxedo Clients

An Oracle Tuxedo ATMI client is a software module that collects a user request and forwards it to a server that offers the requested service. Almost any software module can become an Oracle Tuxedo client by calling the ATMI client initialization routine and “joining” the Oracle Tuxedo application. The client can then allocate message buffers and exchange information with the server.

The client calls the ATMI termination routine to “leave” the application and notify the Oracle Tuxedo system that it (the client) no longer needs to be tracked. Consequently, Oracle Tuxedo application resources are made available for other operations.

The operation of a basic client process can be summarized by the pseudo-code shown in the following listing.

Listing Pseudo-code for a Request/Response Client

main()
 {
     allocate a TPINIT buffer
     place initial client identification in buffer
     enroll as a client of the ORACLE Tuxedo application
     allocate buffer
     do while true {
         place user input in buffer
         send service request
         receive reply
         pass reply to the user }
         leave application
 }

Most of the actions described in the above listing are implemented with ATMI functions. Others—placing the user input in a buffer and passing the reply to the user—are implemented with C language functions.

During the “allocate buffer” phase, the client program allocates a memory area, called a typed buffer , from the Oracle Tuxedo run-time system. A typed buffer is simply a memory buffer with an associated format, for example, a C structure.

An ATMI client may send and receive any number of service requests before leaving the application. The client may send these requests as a series of request/response calls or, if it is important to carry state information from one call to the next, by establishing a connection to a conversational server. In both cases, the logic in the client program is similar, but different ATMI functions are required for these two approaches.

Before you can execute an ATMI client, you must run the buildclient command to compile it and link it with the Oracle Tuxedo ATMI and required libraries. Refer to Writing Clients for information on the buildclient command.