Package io.vertx.core.net
Interface AddressResolver
-
@Unstable public interface AddressResolver
A provider for address resolver.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description EndpointResolver<?,?,?,?>
endpointResolver(Vertx vertx)
Return a resolver capable of resolving addresses to endpoints.static AddressResolver
mappingResolver(java.util.function.Function<Address,List<SocketAddress>> mapping)
A simple synchronous resolver for demo and testing purposes.
-
-
-
Method Detail
-
mappingResolver
static AddressResolver mappingResolver(java.util.function.Function<Address,List<SocketAddress>> mapping)
A simple synchronous resolver for demo and testing purposes.The returned resolver uses the
mapping
function to obtain a list of endpoints for a given address. The resolver calls the mapping function when it needs to select an endpoint node.The load balancing state of a given address is reset when the list of endpoints returned by the function has changed. Therefore, when the function returns the same list of endpoints, the load balancing state is preserved.
When the
mapping
returnsnull
or an empty list, implies the endpoint is not valid anymore and fails the server selection.- Parameters:
mapping
- the mapping function- Returns:
- an address resolver
-
endpointResolver
EndpointResolver<?,?,?,?> endpointResolver(Vertx vertx)
Return a resolver capable of resolving addresses to endpoints.- Parameters:
vertx
- the vertx instance- Returns:
- the resolver
-
-