The UnboundID Directory Server supports the LDAP change notification mechanism called “persistent search”. A persistent search is a search request that does not complete, but reports changes as they occur based on the parameters specified when the search request is issued to the server. When an entry changes, the application receives notification of the change and also what changed.
LDAP change notification via the persistent search is implemented using the “Persistent Search Request Control”. The Persistent Search Request Control accepts the following parameters:
|parameter name||parameter description|
|changeTypes||A Set of ADD, DELETE, MODIFY, and MODIFY DN. Any or all of these can be specified|
|changesOnly||A boolean value which if true causes the search to return only entries that have changed.|
|returnECs||A boolean value which if true causes the search to return the Entry Change Notification Control indicating which operation of the set had occurred.|
To implement in code:
- create a
SearchRequestobject that has a
- create a Persistent Search Request Control object with the desired parameters
The OID of the persistent search request control is
2.16.840.1.1137184.108.40.206. Before attempting to use the Persistent Search Request Control check that the directory server supports the control by looking for the OID in the root DSE. Here’s how to do that from the shell:
ldapsearch -h localhost -p 1389 -b '' -s base '(&)' + \ | perl -lane 'print if /2.16.840.1.1137220.127.116.11/' supportedControl: 2.16.840.1.113718.104.22.168
The file PersistentSearchExample.java demonstrates how to code a simple persistent search.