ResolvedAddress
- The type of address after resolution.E
- Type of ServiceDiscovererEvent
s published from ServiceDiscoverer.discover(Object)
.public static final class DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>>
extends java.lang.Object
DefaultServiceDiscoveryRetryStrategy
.Modifier and Type | Method and Description |
---|---|
ServiceDiscoveryRetryStrategy<ResolvedAddress,E> |
build()
Creates a new
ServiceDiscoveryRetryStrategy . |
DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E> |
retainAddressesTillSuccess(boolean retainAddressesTillSuccess)
A
Publisher returned from ServiceDiscoverer.discover(Object) may fail transiently leaving the
consumer of these events with an option of either disposing the addresses that were provided before the
error or retain them till a retry succeeds. |
DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E> |
retryStrategy(BiIntFunction<java.lang.Throwable,? extends Completable> retryStrategy)
Specifies a
BiFunction which is applied as-is using Publisher.retryWhen(BiIntFunction)
on the Publisher passed to DefaultServiceDiscoveryRetryStrategy.apply(Publisher) . |
static <ResolvedAddress> |
withDefaults(Executor executor,
java.time.Duration initialDelay)
Creates a new builder that uses default retries.
|
static <ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>> |
withDefaults(Executor executor,
java.time.Duration initialDelay,
java.util.function.UnaryOperator<E> flipAvailability)
Creates a new builder that uses default retries.
|
static <ResolvedAddress> |
withDefaultsForPartitions(Executor executor,
java.time.Duration initialDelay)
Creates a new builder that uses default retries.
|
public DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E> retainAddressesTillSuccess(boolean retainAddressesTillSuccess)
Publisher
returned from ServiceDiscoverer.discover(Object)
may fail transiently leaving the
consumer of these events with an option of either disposing the addresses that were provided before the
error or retain them till a retry succeeds. This option enables/disables retention of addresses after an
error is observed till a subsequent success is observed.retainAddressesTillSuccess
- Enables retention of addresses when true
.this
.public DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E> retryStrategy(BiIntFunction<java.lang.Throwable,? extends Completable> retryStrategy)
BiFunction
which is applied as-is using Publisher.retryWhen(BiIntFunction)
on the Publisher
passed to DefaultServiceDiscoveryRetryStrategy.apply(Publisher)
.retryStrategy
- A BiFunction
which is applied as-is using
Publisher.retryWhen(BiIntFunction)
on the Publisher
passed to
DefaultServiceDiscoveryRetryStrategy.apply(Publisher)
.this
.public ServiceDiscoveryRetryStrategy<ResolvedAddress,E> build()
ServiceDiscoveryRetryStrategy
.ServiceDiscoveryRetryStrategy
.public static <ResolvedAddress> DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,ServiceDiscovererEvent<ResolvedAddress>> withDefaults(Executor executor, java.time.Duration initialDelay)
ResolvedAddress
- The type of address after resolution.executor
- Executor
to use for retry backoffs.initialDelay
- Duration
to use as initial delay for backoffs.DefaultServiceDiscoveryRetryStrategy.Builder
.public static <ResolvedAddress> DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,PartitionedServiceDiscovererEvent<ResolvedAddress>> withDefaultsForPartitions(Executor executor, java.time.Duration initialDelay)
ResolvedAddress
- The type of address after resolution.executor
- Executor
to use for retry backoffs.initialDelay
- Duration
to use as initial delay for backoffs.DefaultServiceDiscoveryRetryStrategy.Builder
.public static <ResolvedAddress,E extends ServiceDiscovererEvent<ResolvedAddress>> DefaultServiceDiscoveryRetryStrategy.Builder<ResolvedAddress,E> withDefaults(Executor executor, java.time.Duration initialDelay, java.util.function.UnaryOperator<E> flipAvailability)
ResolvedAddress
- The type of address after resolution.E
- Type of ServiceDiscovererEvent
s published from ServiceDiscoverer.discover(Object)
.executor
- Executor
to use for retry backoffs.initialDelay
- Duration
to use as initial delay for backoffs.flipAvailability
- UnaryOperator
that returns a new ServiceDiscovererEvent
that is the
same as the passed ServiceDiscovererEvent
but with ServiceDiscovererEvent.isAvailable()
value
flipped.DefaultServiceDiscoveryRetryStrategy.Builder
.