Hi!
And thanks for quick response. My exact versions are these:
- camel-version>2.7.0
- activemq-version 5.4.2
Development machine:
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
I also checked Apache DS which I'm using. It appears that Apache DS doesn't
support paged results and it should respond with
javax.naming.OperationNotSupportedException: [LDAP: error code 12 -
Unsupport critical control when trying to retrieve paged results. I didn't
get that so I don't think the ldap-component sends '*pagedResultsControl' *to
server.
If I have time I'll try the behaviour with OpenLDAP during the weekend.
Darwin Mac.local 10.7.0 Darwin Kernel Version 10.7.0
On Thu, May 12, 2011 at 9:39 PM, Hadrian Zbarcea <[email protected]> wrote:
> Aki,
>
> I will open an improvement jira for camel-ldap. For reference, what
> platform and what ldap server are you using?
>
> Thanks,
> Hadrian
>
>
> On May 12, 2011, at 1:56 PM, Aki Ristkari wrote:
>
> > Hi!
> >
> >
> > I'm working on a system that must periodically grab bunch of users from
> LDAP
> > and pass them along via different processors. However the problem is that
> I
> > have >1500 users and this causes problems.
> >
> > Camel-LDAP states that InitialDirContext to be passed to LDAP-bean but in
> > case I want to use 'pageSize' option to page the results I need to pass
> in
> > LdapContext. Now there is high probability that I just suck but I'm
> having
> > troubles getting this to work.
> >
> > Now first my route is like this (I stripped unnecessary stuff out of it).
> >
> > <camel:route>
> > <camel:from uri="activemq:queue:UserQueue"/>
> > <camel:to
> >
> uri="ldap:ldapserver?base=ou=people,o=sevenSeas&scope=subtree&pageSize=250"/>
> > <camel:to uri="bean:ldapProcessor"/>
> > </camel:route>
> >
> >
> >
> > If I define 'ldapserver' like this and pass in InitialDirContext:
> >
> > <bean id="ldapserver" class="javax.naming.directory.InitialDirContext"
> > scope="prototype">
> > <constructor-arg>
> > <props>
> > <prop
> >
> key="javax.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop>
> > <prop
> key="javax.naming.provider.url">ldap://localhost:389</prop>
> > <prop key="javax.naming.security.authentication">simple</prop>
> > <prop key="javax.naming.REFERRAL">ignore</prop>
> > <prop key="javax.naming.SECURITY_AUTHENTICATION">simple</prop>
> > <prop
> > key="javax.naming.security.SECURITY_PRINCIPAL">uid=admin,ou=system</prop>
> > <prop
> > key="javax.naming.security.SECURITY_CREDENTIALS">secret</prop>
> > </props>
> > </constructor-arg>
> > </bean>
> >
> >
> > It work but fails when there are too many users (ie. when the servers
> > configured max-size is reched).
> >
> >
> > My next attempt is to use LdapContext like this:
> >
> > <bean id="ldapServer" class="javax.naming.ldap.InitialLdapContext">
> > <constructor-arg index="0" type="java.util.Hashtable">
> > <map>
> > <entry key="java.naming.factory.initial"
> > value="com.sun.jndi.ldap.LdapCtxFactory"/>
> > <entry key="java.naming.provider.url"
> > value="ldap://localhost:389"/>
> > <entry key="javax.naming.security.authentication"
> > value="simple"/>
> > <entry key="javax.naming.REFERRAL" value="ignore"/>
> > <entry key="javax.naming.SECURITY_AUTHENTICATION"
> > value="simple"/>
> > <entry key="javax.naming.security.SECURITY_PRINCIPAL"
> > value="uid=admin,ou=system"/>
> > <entry key="javax.naming.security.SECURITY_CREDENTIALS"
> > value="secret"/>
> > </map>
> > </constructor-arg>
> > <constructor-arg index="1">
> > <null/>
> > </bean>
> >
> >
> > I construct the environment for LdapContext and null for Controls. I
> assume
> > that 'pageSize=250' on the route definition should take care of that.
> > This works but throws exception: Stack trace:
> > javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit
> > Exceeded];
> >
> >
> >
> > My second attempt is to insert 'PagedResultsControl' for 'LdapContext'
> like
> > this:
> >
> > <bean id="sc" class="javax.naming.ldap.PagedResultsControl">
> > <constructor-arg index="0">
> > <value>250</value>
> > </constructor-arg>
> > <constructor-arg index="1">
> > <value>true</value>
> > </constructor-arg>
> > </bean>
> >
> >
> > <bean id="ldapServer" class="javax.naming.ldap.InitialLdapContext">
> > <constructor-arg index="0" type="java.util.Hashtable">
> > <map>
> > <entry key="java.naming.factory.initial"
> > value="com.sun.jndi.ldap.LdapCtxFactory"/>
> > <entry key="java.naming.provider.url"
> > value="ldap://localhost:389"/>
> > <entry key="javax.naming.security.authentication"
> > value="simple"/>
> > <entry key="javax.naming.REFERRAL" value="ignore"/>
> > <entry key="javax.naming.SECURITY_AUTHENTICATION"
> > value="simple"/>
> > <entry key="javax.naming.security.SECURITY_PRINCIPAL"
> > value="uid=admin,ou=system"/>
> > <entry key="javax.naming.security.SECURITY_CREDENTIALS"
> > value="secret"/>
> > </map>
> > </constructor-arg>
> > <constructor-arg index="1">
> > <ref bean="sc"/>
> > </constructor-arg>
> > </bean>
> >
> > However this defies logic since I don't want to set the pageSize in these
> > bean-definitions but in the route.
> >
> >
> > I've tried reading the docs but quite frankly those are quite scattered
> and
> > mostly deal with Java-DSL. Any help would be much appreciated!
> >
> >
> > Br,
> > Ojis
>
>