Package io.servicetalk.client.api
Class DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>>
java.lang.Object
io.servicetalk.concurrent.api.DelegatingAsyncCloseable<T>
io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>>
io.servicetalk.client.api.DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>
- Type Parameters:
UnresolvedAddress
- The type of address before resolution.ResolvedAddress
- The type of address after resolution.E
- Type ofServiceDiscovererEvent
s published fromdiscover(Object)
.
- All Implemented Interfaces:
ServiceDiscoverer<UnresolvedAddress,
,ResolvedAddress, E> AsyncCloseable
,ListenableAsyncCloseable
public class DelegatingServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>>
extends DelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>>
implements ServiceDiscoverer<UnresolvedAddress,ResolvedAddress,E>
A
ServiceDiscoverer
that delegates all methods to another ServiceDiscoverer
.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final ServiceDiscoverer<UnresolvedAddress,
ResolvedAddress, E> delegate()
Get theServiceDiscoverer
that this class delegates to.discover
(UnresolvedAddress address) Subscribe to the service discovery system for changes in the availableServiceDiscoverer
associated withaddress
.Methods inherited from class io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable
onClose, onClosing
Methods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefully, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Constructor Details
-
DelegatingServiceDiscoverer
Creates a new instance.- Parameters:
delegate
-ServiceDiscoverer
to which all methods are delegated.
-
-
Method Details
-
delegate
Get theServiceDiscoverer
that this class delegates to.- Overrides:
delegate
in classDelegatingListenableAsyncCloseable<ServiceDiscoverer<UnresolvedAddress,
ResolvedAddress, E extends ServiceDiscovererEvent<ResolvedAddress>>> - Returns:
- the
ServiceDiscoverer
that this class delegates to.
-
discover
Description copied from interface:ServiceDiscoverer
Subscribe to the service discovery system for changes in the availableServiceDiscoverer
associated withaddress
.In general a call to this method will continue to discover changes related to
address
until theSubscription
corresponding to the return value iscancelled
orPublisher
fails with an error. The returnedPublisher
should nevercomplete
because underlying system may run for a long period of time and updates may be required at any time in the future. The returnedPublisher
MUST support re-subscribes to allow underlying systems retry failures or re-subscribe aftercancellation
.- Specified by:
discover
in interfaceServiceDiscoverer<UnresolvedAddress,
ResolvedAddress, E extends ServiceDiscovererEvent<ResolvedAddress>> - Parameters:
address
- the service address to discover. Examples of what this address maybe are:- hostname/port (e.g. InetAddress)
- service name
- it may be a list of attributes which describe the service attributes to resolve
- something else
- Returns:
- a
Publisher
that represents a stream of events from the service discovery system.
-