Package discord4j.gateway
Class GatewayReactorResources
java.lang.Object
discord4j.common.ReactorResources
discord4j.gateway.GatewayReactorResources
Provides an extra level of configuration for
ReactorResources, tailored for the Gateway operations.
Allows customizing the Scheduler used to send gateway payloads.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class discord4j.common.ReactorResources
DEFAULT_BLOCKING_TASK_SCHEDULER, DEFAULT_HTTP_CLIENT, DEFAULT_TIMER_TASK_SCHEDULER -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.GatewayReactorResources(ReactorResources parent, Scheduler payloadSenderScheduler) Create Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.protectedGatewayReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, Scheduler payloadSenderScheduler) Create Gateway resources allowing full customization of its properties. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns a new builder to createGatewayReactorResources.builder(ReactorResources reactorResources) Returns a new builder to createGatewayReactorResourcesfrom a pre-configuredReactorResources, copying its settings.static GatewayReactorResourcescreate()Create a default set of Gateway resources.Get the scheduler used for sending gateway payloads.mutate()Returns a builder to create a newGatewayReactorResourceswith settings copied from the currentGatewayReactorResources.Methods inherited from class discord4j.common.ReactorResources
getBlockingTaskScheduler, getHttpClient, getTimerTaskScheduler, newHttpClient, newHttpClient
-
Field Details
-
DEFAULT_PAYLOAD_SENDER_SCHEDULER
-
-
Constructor Details
-
GatewayReactorResources
Create Gateway resources based offReactorResourcesproperties, and providing defaults for the remaining properties.- Parameters:
parent- the resources instance to get properties from
-
GatewayReactorResources
Create Gateway resources based offReactorResourcesproperties, and allowing customization of the remaining properties.- Parameters:
parent- the resources instance to get properties frompayloadSenderScheduler- aSchedulerfor sending payloads. A default can be created fromDEFAULT_PAYLOAD_SENDER_SCHEDULER
-
GatewayReactorResources
public GatewayReactorResources(HttpClient httpClient, Scheduler timerTaskScheduler, Scheduler blockingTaskScheduler, Scheduler payloadSenderScheduler) Create Gateway resources allowing full customization of its properties.- Parameters:
httpClient- the HTTP client to use for initiating Gateway websocket connections. A default is provided inReactorResources.DEFAULT_HTTP_CLIENTtimerTaskScheduler- the scheduler for timed tasks. A default can be created fromReactorResources.DEFAULT_TIMER_TASK_SCHEDULERblockingTaskScheduler- the scheduler for blocking tasks. A default can be created fromReactorResources.DEFAULT_BLOCKING_TASK_SCHEDULERpayloadSenderScheduler- a scheduler for sending payloads. A default can be created fromDEFAULT_PAYLOAD_SENDER_SCHEDULER
-
GatewayReactorResources
-
-
Method Details
-
create
Create a default set of Gateway resources.- Returns:
- a new
GatewayReactorResourcesusing all default properties
-
builder
Returns a new builder to createGatewayReactorResources.- Returns:
- a builder to create
GatewayReactorResources
-
builder
Returns a new builder to createGatewayReactorResourcesfrom a pre-configuredReactorResources, copying its settings.- Returns:
- a builder to create
GatewayReactorResourceswith settings copied from parent resources
-
mutate
Returns a builder to create a newGatewayReactorResourceswith settings copied from the currentGatewayReactorResources.- Returns:
- a builder based off this instance properties
-
getPayloadSenderScheduler
Get the scheduler used for sending gateway payloads.- Returns:
- a scheduler for payload tasks
-