LDAP: Change Notification Using Persistent Search


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 SearchRequest object that has a SearchResultListener
  • create a Persistent Search Request Control object with the desired parameters

The OID of the persistent search request control is 2.16.840.1.113730.3.4.3. 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.113730.3.4.3/'
supportedControl: 2.16.840.1.113730.3.4.3

Example

The file PersistentSearchExample.java demonstrates how to code a simple persistent search.

References

About Terry Gardner

Terry Gardner was a leading directory services architect with experience with many large scale directory services installations and messaging server installations, and was a Subject Matter Expert in the field of Directory Services and Solaris (operating system) performance. Mr. Gardner also participated in the open-source software community. Mr. Gardner passed away in December, 2013.
This entry was posted in computing, Java, LDAP and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s