EnterpriseDBDAC

TEDBNotify

Previous Next

TEDBNotify provides the interface to EnterpriseDB Asynchronous Notification functionalities. To learn how does EnterpriseDB Asynchronous Notification work, please see Asynchronous Notification section of EnterpriseDB documentation.

Use TEDBNotify to organize notifications between client applications about their actions through EnterpriseDB database server.

To use TEDBNotify you should do the following:

1. Create a rule for table on which changes you want to be notified:

create rule InsertDetect as on INSERT to notify_test do notify recinsert

2. Add recinsert to ListenList property of TEDBNotify component;

3. Write event handler for OnNotify event:

procedure TForm1.EDBNotify1Notify(Sender: TObject; Event: String; Pid : Integer);
begin
   if PID <> DB.GetBackendPID then  // If it is not me...
      Memo1.Lines.Add(
      Format('Client (PID=%d) just modified (event = %s) table notify_test. Press Refresh',
      [PID, Event]));
end;

4. Link Database property of TEDBNotify component to EDBDatabase component;

5. To begin listen notifications, set Active property of TEDBNotify to True.

After compilation you can see rows insertions in Memo1 component when other clients make inserts in notify_test table. Also you can do the same for DELETE and UPDATE events.

See also:Properties, Methods, Events