public class DefaultRouter extends Object implements Router
DiscordRequests
to the proper
RequestStream
according to the bucket in which the request falls.
Must be cached using SingleRouterFactory
if intended for sharding, to properly
coordinate queueing and rate-limiting across buckets.
Constructor and Description |
---|
DefaultRouter(DiscordWebClient httpClient)
Create a bucket-aware router using the defaults provided by
RouterOptions.create() . |
DefaultRouter(DiscordWebClient httpClient,
RouterOptions routerOptions)
Create a Discord API bucket-aware
Router configured with the given options. |
DefaultRouter(DiscordWebClient httpClient,
Scheduler responseScheduler,
Scheduler rateLimitScheduler)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
<T> Mono<T> |
exchange(DiscordRequest<T> request)
Queues a request for execution.
|
public DefaultRouter(DiscordWebClient httpClient)
RouterOptions.create()
.httpClient
- the web client executing each request instructed by this router@Deprecated public DefaultRouter(DiscordWebClient httpClient, Scheduler responseScheduler, Scheduler rateLimitScheduler)
DefaultRouter(DiscordWebClient, RouterOptions)
httpClient
- the web client executing each request instructed by this routerresponseScheduler
- the scheduler used to execute each requestrateLimitScheduler
- the scheduler used to perform delays caused by rate limitingpublic DefaultRouter(DiscordWebClient httpClient, RouterOptions routerOptions)
Router
configured with the given options.httpClient
- the web client executing each request instructed by this routerrouterOptions
- the options that configure this Router
public <T> Mono<T> exchange(DiscordRequest<T> request)
Router