You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

LDAP Component

The ldap: component allows you to perform searches in LDAP servers using filters as the message payload.
This component uses standard JNDI (javax.naming) to access the server.

URI format

ldap:ldapServerUrl?options

This component only supports producer, meaning that you can not use routes with this component in the from type.

Options

Name

Default Value

Description

base

ou=system

The base DN for searches

scope

subtree

Search the whole subtree. Value must be one of: "object", "onelevel" or "subtree"

Result

The result is returned in the out body as a ArrayList<javax.naming.directory.SearchResult> list object with the result.

Samples

In the sample below we fetches the rows from the customer table.

First we register our datasource in the Camel registry as testdb:

Error formatting macro: snippet: java.lang.NullPointerException

Then we configure a route that routes to the LDAP component so the search will be executed, notice that we refer to the LdapContext that was bound in the previous step:

Error formatting macro: snippet: java.lang.NullPointerException

And then we create the endpoint and sends the exchange containing the LDAP filter to execute in the in body. The result is returned in the out body.

Error formatting macro: snippet: java.lang.NullPointerException

Sample - Polling the server every minute

If we want to poll an LDAP server using this component we need to combine this with a polling scheduler such as the Timer or Quartz etc.
In this sample we retrieve data every 60th seconds.

from("timer://foo?period=60000").setBody(constant("(o=apache)")).to("ldap:localhost:1024").to("activemq:queue:committers");
  • No labels