Package discord4j.rest.request
Interface RequestQueueFactory
public interface RequestQueueFactory
Factory to create
RequestQueue
instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic RequestQueueFactory
backedByProcessor
(Supplier<FluxProcessor<Object, Object>> processorSupplier, FluxSink.OverflowStrategy overflowStrategy) Deprecated.static RequestQueueFactory
Returns a factory ofRequestQueue
with default parameters capable of buffering requests up to a reasonable capacity, then applying a delay on overflowing requests.<T> RequestQueue<T>
create()
Creates a newRequestQueue
instance.static RequestQueueFactory
createFromSink
(Function<Sinks.ManySpec, Sinks.Many<Object>> requestSinkFactory, EmissionStrategy emissionStrategy) Returns a factory ofRequestQueue
backed by aSinks.Many
instance.
-
Method Details
-
create
Creates a newRequestQueue
instance.- Type Parameters:
T
- the desired generic type ofRequestQueue
- Returns:
- the freshly instantiated
RequestQueue
-
backedByProcessor
@Deprecated static RequestQueueFactory backedByProcessor(Supplier<FluxProcessor<Object, Object>> processorSupplier, FluxSink.OverflowStrategy overflowStrategy) Deprecated.use the new Sinks API based approach atcreateFromSink(Function, EmissionStrategy)
Returns a factory ofRequestQueue
backed by aFluxProcessor
.- Parameters:
processorSupplier
- a Supplier that provides a processor. The Supplier must provide a new instance every time it is called, and the processor must not be pre-filled with any elements, otherwise it may lead to non-deterministic behavior.overflowStrategy
- the overflow strategy to apply on the processor- Returns:
- a
RequestQueueFactory
backed by aFluxProcessor
-
createFromSink
static RequestQueueFactory createFromSink(Function<Sinks.ManySpec, Sinks.Many<Object>> requestSinkFactory, EmissionStrategy emissionStrategy) Returns a factory ofRequestQueue
backed by aSinks.Many
instance.- Parameters:
requestSinkFactory
- a Function that provides a sink. The factory must provide a new instance every time it is called, and the processor must not be pre-filled with any elements, otherwise it may lead to non-deterministic behavior.emissionStrategy
- the strategy to handle request submission (emission) failures- Returns:
- a
RequestQueueFactory
backed by aSinks.Many
-
buffering
Returns a factory ofRequestQueue
with default parameters capable of buffering requests up to a reasonable capacity, then applying a delay on overflowing requests.- Returns:
- a
RequestQueueFactory
backed by a multicastingSinks.Many
with capacity given byQueues.SMALL_BUFFER_SIZE
and a parkingEmissionStrategy
.
-
createFromSink(Function, EmissionStrategy)