Package discord4j.core
Class GatewayResources
- java.lang.Object
-
- discord4j.core.GatewayResources
-
public class GatewayResources extends Object
A set of dependencies required to build and coordinate multipleGatewayClient
instances.
-
-
Constructor Summary
Constructors Constructor Description GatewayResources(StateView stateView, EventDispatcher eventDispatcher, ShardCoordinator shardCoordinator, MemberRequestFilter memberRequestFilter, GatewayReactorResources gatewayReactorResources, VoiceReactorResources voiceReactorResources, ReconnectOptions voiceReconnectOptions, discord4j.discordjson.possible.Possible<IntentSet> intents, Duration memberRequestTimeout)
Create a newGatewayResources
with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description EventDispatcher
getEventDispatcher()
Distributes events to subscribers.GatewayReactorResources
getGatewayReactorResources()
Return theGatewayReactorResources
used to perform Gateway-related operations.discord4j.discordjson.possible.Possible<IntentSet>
getIntents()
MemberRequestFilter
getMemberRequestFilter()
Return aMemberRequestFilter
indicating whether this shard group should be requesting guild members.Duration
getMemberRequestTimeout()
Deprecated.to be removed in v3.2, as Gateway Intents are mandatory and client-side validations can be reliably performedShardCoordinator
getShardCoordinator()
Returns theShardCoordinator
that is capable of coordinating certain shard actions.StateView
getStateView()
Deprecated.v3.2.0 will introduce a new way of working with stores, see this pull request for detailsVoiceReactorResources
getVoiceReactorResources()
Return theVoiceReactorResources
used to perform Voice Gateway-related operations.ReconnectOptions
getVoiceReconnectOptions()
Return the reconnect policy used to retry a connection to the Voice Gateway.
-
-
-
Constructor Detail
-
GatewayResources
public GatewayResources(StateView stateView, EventDispatcher eventDispatcher, ShardCoordinator shardCoordinator, MemberRequestFilter memberRequestFilter, GatewayReactorResources gatewayReactorResources, VoiceReactorResources voiceReactorResources, ReconnectOptions voiceReconnectOptions, discord4j.discordjson.possible.Possible<IntentSet> intents, Duration memberRequestTimeout)
Create a newGatewayResources
with the given parameters.- Parameters:
stateView
- a read-only facade for an entity cache based offStateHolder
eventDispatcher
- an event bus dedicated to distributeEvent
instancesshardCoordinator
- a middleware component to coordinate multiple shard-connecting effortsmemberRequestFilter
- a strategy to determine whether guild members should be requestedgatewayReactorResources
- a custom set of Reactor resources targeting Gateway operationsvoiceReactorResources
- a set of Reactor resources targeting Voice Gateway operationsvoiceReconnectOptions
- a reconnection policy for Voice Gateway connectionsintents
- an optional set of events to subscribe when connecting to the GatewaymemberRequestTimeout
- aDuration
to limit the time member list requests take
-
-
Method Detail
-
getIntents
public discord4j.discordjson.possible.Possible<IntentSet> getIntents()
- Returns:
- The
IntentSet
tied to thisGatewayResources
-
getStateView
public StateView getStateView()
Deprecated.v3.2.0 will introduce a new way of working with stores, see this pull request for detailsRepository aggregate view of all caching related operations. Discord Gateway mandates its clients to cache its updates through events coming from the real-time websocket. TheStateView
is a read-only facade forStateHolder
which is the mediator for the underlyingStore
instances for each cached entity.- Returns:
- the
StateView
tied to thisGatewayResources
-
getEventDispatcher
public EventDispatcher getEventDispatcher()
Distributes events to subscribers. Starting from v3.1, theEventDispatcher
is capable of distributing events from allGatewayClient
connections (shards) that were specified when thisGatewayDiscordClient
was created.- Returns:
- the
EventDispatcher
tied to thisGatewayResources
-
getShardCoordinator
public ShardCoordinator getShardCoordinator()
Returns theShardCoordinator
that is capable of coordinating certain shard actions.- Returns:
- the
ShardCoordinator
tied to thisGatewayResources
-
getMemberRequestFilter
public MemberRequestFilter getMemberRequestFilter()
Return aMemberRequestFilter
indicating whether this shard group should be requesting guild members.- Returns:
- the
MemberRequestFilter
configured in thisGatewayResources
-
getGatewayReactorResources
public GatewayReactorResources getGatewayReactorResources()
Return theGatewayReactorResources
used to perform Gateway-related operations.- Returns:
- the Gateway Reactor resources
-
getVoiceReactorResources
public VoiceReactorResources getVoiceReactorResources()
Return theVoiceReactorResources
used to perform Voice Gateway-related operations.- Returns:
- the Voice Gateway Reactor resources
-
getVoiceReconnectOptions
public ReconnectOptions getVoiceReconnectOptions()
Return the reconnect policy used to retry a connection to the Voice Gateway.- Returns:
- a reconnection policy
-
getMemberRequestTimeout
@Deprecated public Duration getMemberRequestTimeout()
Deprecated.to be removed in v3.2, as Gateway Intents are mandatory and client-side validations can be reliably performedReturn aDuration
to be used when the target client requests a complete list of guild members through the Gateway. Such requests might never be fulfilled if Gateway Intents are not used and privileged guild members intent is not enabled in the developer panel.- Returns:
- the default timeout to be applied on complete member list requests
-
-