Hi,
In PostgresDAC, there was an option to listen to all events that the session is has registered using the LISTEN command.
So I could simply have an alerter, and register the events using a LISTEN command in some PlPgSQL function exactly where I would like to start listening.
With PgDAC, I cannot just use the LISTEN command alone in my own SQL statement but I have to use the TPgAlerter.Event, which is a comma delimited string that I have to maintain. When I make changes to that string, I have to Stop and re-Start the alerter...
Can there be an option to listen to everything - so I could control what I want to listen to using LISTEN and UNLISTEN statements elsewhere, without having to touch the TPgAlerter on the client-side.
Thanks
Alerter
TPgAlerter uses separate connection to listen events. So LISTEN and UNLISTEN commands do not affect the alerter.
You can use the OnNotification event of TPgConnection instead of TPgAlerter. This event occurs when notification comes on the main connection. Note: OnNotification event can occur only after you execute some query or other server operation. The server sends a notification in response to a query.
You can use the OnNotification event of TPgConnection instead of TPgAlerter. This event occurs when notification comes on the main connection. Note: OnNotification event can occur only after you execute some query or other server operation. The server sends a notification in response to a query.
Alerter can get notifications in two ways:
1. Listen the connection all the time, and read notifications when they became available on the connection. This method requires the connection to be used by the alerter only. Other components cannot use this connection. This method is used by TPgAlerter.
2. Use the timer, and execute a query on the connection periodically. Notifications are received as response to the query. This way is used by the alerter in PostgresDAC. You can emulate this method in the following way: place TTimer component on the form and execute a query in the OnTimer event.
1. Listen the connection all the time, and read notifications when they became available on the connection. This method requires the connection to be used by the alerter only. Other components cannot use this connection. This method is used by TPgAlerter.
2. Use the timer, and execute a query on the connection periodically. Notifications are received as response to the query. This way is used by the alerter in PostgresDAC. You can emulate this method in the following way: place TTimer component on the form and execute a query in the OnTimer event.