-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Cluster Management
Updated Description
A new interface, com.mongodb.spi.dns.DnsClient will be created that defines a minimal API for a DNS provider. Additionally, a service provider interface, com.mongodb.spi.dns.DnsClientProvider will be created. The latter will be used by the driver to look up implementations of DnsClient via the mechanisms described in java.util.ServiceLoader. If no implementations are found, the driver will fallback to using JNDI for looking up SRV and TXT records (which is the current behavior).
Original Description
When resolving mongo+srv:// URLs, the MongoDB client (in Java) uses JNDI. However, with GraalVM, JNDI is not supported when building native executables.
At the moment, in Quarkus, we have a "substitution" that replaces the default DNS client when building a native executable.
It would be great to avoid substituting and instead allow the user to customize the DNS client they want to use (defaulting to the current one). There is already a DNS client interface.
There are two possibilities:
- Allows the user to pass a DNS client interface implementation class when configuring the driver
- Exposes the DNS client interface as an SPI. When there is a provider on the classpath, use that provider instead of the default one.