Waiting for Events with EVENT WAIT

From InterBase

Go Up to Working with Events


Even after an application registers interest in an event, it does not receive notification about that event. Before it can receive notification, it must use the EVENT WAIT statement to indicate its readiness to the event manager, and to suspend its processing until notification occurs.

To signal the event manager and suspend an application’s processing, use the following EVENT WAIT statement syntax:

EXEC SQL
EVENT WAIT request_name;

<request_name> must be the name of a request handle declared in a previous EVENT INIT statement.

The following statements register interest in an event, and wait for event notification:

EXEC SQL
EVENT INIT RESPOND_NEW ('new_order');
EXEC SQL
EVENT WAIT RESPOND_NEW;

Once EVENT WAIT is executed, application processing stops until the event manager sends a notification message to the application.

Note:
An application can contain more than one EVENT WAIT statement, but all processing stops when the first statement is encountered. Each time processing restarts, it stops when it encounters the next EVENT WAIT statement.

If one event occurs while an application is processing another, the event manager sends notification the next time the application returns to a wait state.

Advance To: