![]() |
![]() |
|
|
Advertising and Unadvertising Services
When a server is booted, it advertises the services it offers based on the values specified for the CLOPT parameter in the configuration file.
Note: The services that a server may advertise are initially defined when the buildserver command is executed. The -s option allows a comma-separated list of services to be specified. It also allows you to specify a function with a name that differs from that of the advertised service that is to be called to process the service request. Refer to the buildserver(1) in the BEA Tuxedo Command Reference for more information.
The default specification calls for the server to advertise all services with which it was built. Refer to the UBBCONFIG(5) or servopts(5) reference page in the File Formats, Data Descriptions, MIBs, and System Processes Reference for more information.
Because an advertised service uses a service table entry in the bulletin board, and can therefore be resource-expensive, an application may boot its servers in such a way that only a subset of the services offered are available. To limit the services available in an application, define the CLOPT parameter, within the appropriate entry in the SERVERS section of the configuration file, to include the desired services in a comma-separated list following the -s option. The -s option also allows you to specify a function with a name other than that of the advertised service to be called to process the request. Refer to the servopts(5) reference page in the File Formats, Data Descriptions, MIBs, and System Processes Reference for more information.
A BEA Tuxedo application administrator can use the advertise and unadvertise commands of tmadmin(1) to control the services offered by servers. The tpadvertise() and tpunadvertise() functions enable you to dynamically control the advertisement of a service in a request/response or conversational server. The service to be advertised (or unadvertised) must be available within the same server as the service making the request.
Advertising Services
Use the following signature to call the tpadvertise(3c) function:
int
tpadvertise(char *svcname, void *func)
The following table describes the arguments to the tpadvertise() function.
tpadvertise( ) Function Arguments
Unadvertising Services The tpunadvertise(3c) function removes the name of a service from the service table of the bulletin board so that the service is no longer advertised. Use the following signature for the tpunadvertise() function: The tpunadvertise() function contains one argument, which is described in the following table. tpunadvertise( ) FunctionArguments
tpunadvertise(char *svcname)
char *svcname;
Example: Dynamic Advertising and Unadvertising of a Service The following example shows how to use the tpadvertise() function. In this example, a server called TLR is programmed to offer only the service called TLR_INIT when booted. After some initialization, TLR_INIT advertises two services called DEPOSIT and WITHDRAW. Both are performed by the tlr_funcs function, and both are built into the TLR server. After advertising DEPOSIT and WITHDRAW, TLR_INIT unadvertises itself. Dynamic Advertising and Unadvertisingextern void tlr_funcs()
.
.
.
if (tpadvertise("DEPOSIT", (tlr_funcs)(TPSVCINFO *)) == -1)
check for errors;
if (tpadvertise("WITHDRAW", (tlr_funcs)(TPSVCINFO *)) == -1)
check for errors;
if (tpunadvertise("TLR_INIT") == -1)
check for errors;
tpreturn(TPSUCCESS, 0, transb->data,0L, 0);
![]() |
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|