Package discord4j.rest.request
Interface RequestQueueFactory
public interface RequestQueueFactory
Factory to create
RequestQueue instances.-
Method Summary
Modifier and TypeMethodDescriptionstatic RequestQueueFactorybackedByProcessor(Supplier<FluxProcessor<Object, Object>> processorSupplier, FluxSink.OverflowStrategy overflowStrategy) Deprecated.static RequestQueueFactoryReturns a factory ofRequestQueuewith default parameters capable of buffering requests up to a reasonable capacity, then applying a delay on overflowing requests.<T> RequestQueue<T>create()Creates a newRequestQueueinstance.static RequestQueueFactorycreateFromSink(Function<Sinks.ManySpec, Sinks.Many<Object>> requestSinkFactory, EmissionStrategy emissionStrategy) Returns a factory ofRequestQueuebacked by aSinks.Manyinstance.
-
Method Details
-
create
Creates a newRequestQueueinstance.- 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 ofRequestQueuebacked 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
RequestQueueFactorybacked by aFluxProcessor
-
createFromSink
static RequestQueueFactory createFromSink(Function<Sinks.ManySpec, Sinks.Many<Object>> requestSinkFactory, EmissionStrategy emissionStrategy) Returns a factory ofRequestQueuebacked by aSinks.Manyinstance.- 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
RequestQueueFactorybacked by aSinks.Many
-
buffering
Returns a factory ofRequestQueuewith default parameters capable of buffering requests up to a reasonable capacity, then applying a delay on overflowing requests.- Returns:
- a
RequestQueueFactorybacked by a multicastingSinks.Manywith capacity given byQueues.SMALL_BUFFER_SIZEand a parkingEmissionStrategy.
-
createFromSink(Function, EmissionStrategy)