Clients can be notified of changes to a database through an RDbNotifier
object. This class is particularly useful for shared databases.
A client makes an asynchronous request for notification, and this request completes when:
a transaction is committed
a transaction is rolled back
the database has been recovered
the database is closed
all read-locks are removed
Any number of notifiers can be opened by a client on the same database and they all act identically.
The lifetime of a notifier object is independent of the database that it is observing. For example, a client can close a database before closing a notifier which is observing that database. In this case, the notifier continues to report all activity on the database caused by other clients. Once the last client has closed the database, the notifier reports the status RDbNotifier::EClose
; any further requests for change notification complete immediately with the same status, i.e. RDbNotifier::EClose
.
Notifiers cannot be opened on client-side databases.
Only one request can be outstanding on a single notifier at any one time. If further database events occur while a client is handling the completion of a previous database event, the notifier remembers the most significant event; this is determined as:
a database recovery event (RDbNotifier::ERecover
) is more important than a transaction rollback event (RDbNotifier::ERollback
)
a transaction rollback event (RDbNotifier::ERollback
)is more important than a transaction committed event (RDbNotifier::ECommit
)
Read-locks removed events (RDbNotifier::EUnlock
) are not remembered in this way.