You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Alarm <st...@yahoo.com> on 2015/01/26 13:12:53 UTC

Cannot trigger LDAP Endpoint

Hello, i have the following source code which works pretty well. Meaning, i
can read from a XML file and store the data through an insert statement onto
the DB:


 from("file:src/data?noop=true").bean(new UserConversion(),
"toSql").to("jdbc:oracleDataSource");

The problem starts when i try to read in my bean UserConversion, data which
i fetch from an LDAP Endpoint. I retrieve data from the LDAP with the
following source:


ProducerTemplate template = context.createProducerTemplate();
Collection<?> results = (Collection<?>)
template.sendBody("ldap:ldapserver?base=dc=company,dc=com",
				ExchangePattern.OutOnly, "uid=myuser");

if (results.size() > 0) {
	Iterator<?> resultIter = results.iterator();
	SearchResult searchResult = (SearchResult) resultIter.next();
	Attributes attributes = searchResult.getAttributes();
	Attribute deviceCNAttr = attributes.get("cn");
}


The above part also works pretty well. Now i am having difficulties to user
the from().to() pattern. I cannot find a way how i can add the ldap to
from() as an endpoint and pass also the search criteria i use on the
sendBody function as seen above. 

In detail, i am trying:
1) To use the ldap as an endpoint
2) The retrieved data and pass them inside the bean.

Thank you



--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-trigger-LDAP-Endpoint-tp5762103.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot trigger LDAP Endpoint

Posted by "Walzer, Thomas" <th...@integratix.net>.
I think that is ok. 
You could also use a timer or quartz endpoint to trigger it.

timer -> ldap -> bean works well for me. Not sure if I got your use case.

Cheers, Thomas.

> Am 26.01.2015 um 14:01 schrieb Alarm <st...@yahoo.com>:
> 
> It looks like i found a solution without knowing if this is the best one:
> 
> I use the direct:start as endpoint. 
> 
> from("direct:start").to("ldap:ldapserver?base=dc=company,dc=com").process....
> 
> Then catch this endpoint and add my search criteria and send it to the ldap
> endpoint:
> 
> Endpoint endpoint = context.getEndpoint("direct:start");
> Exchange exchange = endpoint.createExchange();
> exchange.getIn().setBody("uid=user1");
> 
> Finally catch the data through the exchange in the processs() function. 
> 
> Please do let me know if there is a better solution thank this.
> 
> Thank you.
> 
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-trigger-LDAP-Endpoint-tp5762103p5762104.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cannot trigger LDAP Endpoint

Posted by Alarm <st...@yahoo.com>.
It looks like i found a solution without knowing if this is the best one:

I use the direct:start as endpoint. 

from("direct:start").to("ldap:ldapserver?base=dc=company,dc=com").process....

Then catch this endpoint and add my search criteria and send it to the ldap
endpoint:

Endpoint endpoint = context.getEndpoint("direct:start");
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody("uid=user1");

Finally catch the data through the exchange in the processs() function. 

Please do let me know if there is a better solution thank this.

Thank you.




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-trigger-LDAP-Endpoint-tp5762103p5762104.html
Sent from the Camel - Users mailing list archive at Nabble.com.