TPSQLNotify provides the interface to PostgreSQL Asynchronous Notification functionalities. To learn how does PostgreSQL Asynchronous Notification work, please see Asynchronous Notification section of PostgreSQL documentation.
Use TPSQLNotify to organize notifications between client applications about their actions through Postgres database server.
To use TPSQLNotify you should do the following:
1. Create a rule for table on which changes you want to be notified:
2. Add recinsert to ListenList property of TPSQLNotify component;
3. Write event handler for OnNotify event:
4. Link Database property of TPSQLNotify component to PSQLDatabase component;
5. To begin listen notifications, set Active property of TPSQLNotify 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.
Please note, that TPSQLNotify component is not thread-safe because of its internal implementation.