Skip to content

PooledConnectionFactory connected/disconnected events #242

@johnellinwood

Description

@johnellinwood

What is the best way to simply check if a PooledConnectionFactory is healthy or not? As in, if it received connection errors or not on it's last connection attempts, and/or has 0 active and 0 available connections? I just want to notify my application when the remote ldap connection is down, and then back up.

Is there a way to get events from the PooledConnectionFactory when it's underlying connections open, fail, and re-open?

The situation I see is when the remote server goes down, I get these exception in the log at ERROR level.

ERROR org.ldaptive.transport.netty.NettyConnection: Connection open failed for org.ldaptive.transport.netty.NettyConnection 
  org.ldaptive.ConnectException: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: ...
  

I want to capture those exceptions, log them internally as DEBUG, and then event to the rest of my app that ldap is down (ui widget, etc). It's all reactive. But I don't see anywhere at the PooledConnectionFactory or DefaultConnectionFactory to capture these exceptions or put in a customized handler of some type.

For healthy I could put a connection activator on the factory or something to just set it to healthy maybe?

I've looked through the user guide, javadocs, and now am digging through the code looking for a good place to put this.

I could periodically poll the pooled connection factory i think, but i wanted to see if you have a hook for this. What would that polling look like? If i set minPoolSize to 1, and activeCount and availableCount are both 0, then that is unhealthy?

Also, do you have a discord or somewhere to chat these kinds of questions instead of opening issues? Sorry for asking this as an issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions