Class GatewayResources


  • public class GatewayResources
    extends Object
    A set of dependencies required to build and coordinate multiple GatewayClient instances.
    • 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 new GatewayResources with the given parameters.
        Parameters:
        stateView - a read-only facade for an entity cache based off StateHolder
        eventDispatcher - an event bus dedicated to distribute Event instances
        shardCoordinator - a middleware component to coordinate multiple shard-connecting efforts
        memberRequestFilter - a strategy to determine whether guild members should be requested
        gatewayReactorResources - a custom set of Reactor resources targeting Gateway operations
        voiceReactorResources - a set of Reactor resources targeting Voice Gateway operations
        voiceReconnectOptions - a reconnection policy for Voice Gateway connections
        intents - an optional set of events to subscribe when connecting to the Gateway
        memberRequestTimeout - a Duration to limit the time member list requests take
    • Method Detail

      • getStateView

        public StateView getStateView()
        Deprecated.
        v3.2.0 will introduce a new way of working with stores, see this pull request for details
        Repository aggregate view of all caching related operations. Discord Gateway mandates its clients to cache its updates through events coming from the real-time websocket. The StateView is a read-only facade for StateHolder which is the mediator for the underlying Store instances for each cached entity.
        Returns:
        the StateView tied to this GatewayResources
      • getVoiceReactorResources

        public VoiceReactorResources getVoiceReactorResources()
        Return the VoiceReactorResources 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 performed
        Return a Duration 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