Skip to content
October 13, 2011 / Terry Gardner

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

Leave a Reply

Please log in using one of these methods to post your comment:

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 )

Connecting to %s