BEA Logo BEA Tuxedo Release 7.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   Tuxedo Doc Home   |   Programming   |   Topic List   |   Previous   |   Next   |   Contents

   Programming a BEA Tuxedo Application Using C

Sending Unsolicited Messages

The BEA Tuxedo system allows unsolicited messages to be sent to client processes without disturbing the processing of request/response calls or conversational communications.

Unsolicited messages can be sent to client processes by name, using tpbroadcast(3c), or by an identifier received with a previously processed message, using tpnotify(3c). Messages sent via tpbroadcast() can originate either in a service or in another client. Messages sent via tpnotify() can originate only in a service.

Broadcasting Messages By Name

The tpbroadcast(3c) function allows a message to be sent to registered clients of the application. It can be called by a service or another client. Registered clients are those that have successfully made a call to tpinit() and have not yet made a call to tpterm().

Use the following signature to call the tpbroadcast() function.

int
tpbroadcast(char *lmid, char *usrname, char *cltname, char *data, long len, long flags)

The following table describes the arguments to the tpbroadcast() function.

tpbroadcast( ) Function Arguments

Argument

Description

lmid

Pointer to the logical machine identifier for the client. A value of NULL acts as a wildcard, so that a message can be directed to groups of clients.

usrname

Pointer to the user name of the client process, if one exists. A value of NULL acts as a wildcard, so that a message can be directed to groups of clients.

cltname

Pointer to the client name of the client process, if one exists. A value of NULL acts as a wildcard, so that a message can be directed to groups of clients.

data

Pointer to the content of a message.

len

Size of the message buffer. If data points to a self-defining buffer type, for example, FML, then len can be set to 0.

flags

Flag options. Refer to tpbroadcast(3c) in the BEA Tuxedo C Function Reference for information on available flags.

The following example illustrates a call to tpbroadcast() for which all clients are targeted. The message to be sent is contained in a STRING buffer.

Using tpbroadcast( )


char *strbuf;

if ((strbuf = tpalloc("STRING", NULL, 0)) == NULL) {
error routine
}

(void) strcpy(strbuf, "hello, world");

if (tpbroadcast(NULL, NULL, NULL, strbuf, 0, TPSIGRSTRT) == -1)
error routine


Broadcasting Messages by Identifier

The tpnotify(3c) function is used to broadcast a message using an identifier received with a previously processed message. It can be called only from a service.

Use the following signature to call the tpnotify() function.

int
tpnotify(CLIENTID *clientid, char *data, long len, long flags)

The following table describes the arguments to the tpnotify() function.

tpnotify( ) Function Arguments

Argument

Description

clientid

Pointer to a CLIENTID structure that is saved from the TPSVCINFO structure that accompanied the request to this service.

data

Pointer to the content of the message.

len

Size of the message buffer. If data points to a self-defining buffer type, for example, FML, then len can be set to 0.

flags

Flag options. Refer to tpnotify(3c) in the BEA Tuxedo C Function Reference for information on available flags.