4.2.2 Unsolicited Notification Handling

Unsolicited notification refers to any communication with an ATMI client that is not an expected response to a service request (or an error code). For example, an administrator may broadcast a message to indicate that the system will go down in five minutes.

A client can be notified of an unsolicited message in a number of ways. For example, some operating systems might send a signal to the client and interrupt its current processing. By default, the Oracle Tuxedo system checks for unsolicited messages each time an ATMI function is invoked. This approach, referred to as dip-in, is advantageous because it:

  • Is supported on all platforms
  • Does not interrupt the current processing

As some time may elapse between “dip-ins,” the application can call the tpchkunsol() function to check for any waiting unsolicited messages. Refer to Writing Event-based Clients and Servers for more information on the tpchkunsol()function.

When a client joins an application using the tpinit() function, it can control how to handle unsolicited notification messages by defining flags. For client notification, the possible values for flags are defined in the following table.

Table 4-2 Client Notification Flags in a TPINIT Typed Buffer

Flag Description
TPU_SIG Select unsolicited notification by signals. This flag should be used only with single-threaded, single-context applications. The advantage of using this mode is immediate notification. The disadvantages include:
  • The calling process must have the same UID as the sending process when you are running a native client. (Workstation clients do not have this limitation.)
  • TPU_SIG is not available on all platforms (specifically, it is not available on MS-DOS workstations).
If you specify this flag but do not meet the system or environmental requirements, the flag is set to TPU_DIP and the event is logged.
TPU_DIP (default) Select unsolicited notification by dip-in. In this case, the client can specify the name of the message handling function using the tpsetunsol() function, and check for waiting unsolicited messages using the tpchkunsol() function.
TPU_THREAD Select THREAD notification in a separate thread. This flag is allowed only on platforms that support multithreading. If TPU_THREAD is specified on a platform that does not support multithreading, it is considered an invalid argument. As a result, an error is returned and tperrno(5) is set to TPEINVAL.
TPU_IGN Ignore unsolicited notification.

Refer to tpinit(3c) in the Oracle Tuxedo ATMI C Function Reference for more information on the TPINIT typed buffer flags.