public class RetryingDnsServiceDiscovererFilter extends ServiceDiscovererFilter<java.lang.String,java.net.InetAddress,ServiceDiscovererEvent<java.net.InetAddress>>
ServiceDiscoverer
.
Throwable
s that pass shouldRetry(Throwable)
are logged, and the retry strategy is invoked. All
other Throwable
s will result in the Publisher
terminating with the Throwable
.
Constructor and Description |
---|
RetryingDnsServiceDiscovererFilter(ServiceDiscoverer<java.lang.String,java.net.InetAddress,ServiceDiscovererEvent<java.net.InetAddress>> delegate,
BiIntFunction<java.lang.Throwable,Completable> retryStrategy)
Create an instance of the filter.
|
Modifier and Type | Method and Description |
---|---|
Publisher<ServiceDiscovererEvent<java.net.InetAddress>> |
discover(java.lang.String unresolvedAddress)
Subscribe to the service discovery system for changes in the available
ResolvedAddress associated with
address . |
protected boolean |
shouldRetry(java.lang.Throwable cause)
Determines which
Throwable s should be retried. |
closeAsync, closeAsyncGracefully, onClose
public RetryingDnsServiceDiscovererFilter(ServiceDiscoverer<java.lang.String,java.net.InetAddress,ServiceDiscovererEvent<java.net.InetAddress>> delegate, BiIntFunction<java.lang.Throwable,Completable> retryStrategy)
delegate
- the ServiceDiscoverer
to delegate toretryStrategy
- the retry strategy to applypublic Publisher<ServiceDiscovererEvent<java.net.InetAddress>> discover(java.lang.String unresolvedAddress)
ServiceDiscoverer
ResolvedAddress
associated with
address
.
In general a call to this method will continue to discover changes related to address
until the
PublisherSource.Subscription
corresponding to the return value is cancelled via Cancellable.cancel()
or there are no more changes to
publish.
discover
in interface ServiceDiscoverer<java.lang.String,java.net.InetAddress,ServiceDiscovererEvent<java.net.InetAddress>>
discover
in class ServiceDiscovererFilter<java.lang.String,java.net.InetAddress,ServiceDiscovererEvent<java.net.InetAddress>>
unresolvedAddress
- the service address to discover. Examples of what this address maybe are:
Publisher
that represents a stream of events from the service discovery system.protected boolean shouldRetry(java.lang.Throwable cause)
Throwable
s should be retried.cause
- the Throwable
to checkPublisher