Class DefaultShardingStrategy

java.lang.Object
discord4j.core.shard.DefaultShardingStrategy
All Implemented Interfaces:
ShardingStrategy

public class DefaultShardingStrategy extends Object implements ShardingStrategy
  • Field Details

  • Constructor Details

  • Method Details

    • getShardCount

      public Mono<Integer> getShardCount(RestClient restClient)
      Description copied from interface: ShardingStrategy
      Return the shard count used to create a group of sharded clients.
      Specified by:
      getShardCount in interface ShardingStrategy
      Parameters:
      restClient - a handle to consume REST API resources, typically to retrieve the number of recommended shards
      Returns:
      a shard count as a Mono to obtain this number asynchronously.
    • getShards

      public Flux<ShardInfo> getShards(int shardCount)
      Description copied from interface: ShardingStrategy
      Return the shard factory used to create a group of sharded clients.
      Specified by:
      getShards in interface ShardingStrategy
      Parameters:
      shardCount - the total number of shards
      Returns:
      a shard factory as a sequence of ShardInfo items.
    • getGroupManager

      public discord4j.core.shard.GatewayClientGroupManager getGroupManager(int count)
      Description copied from interface: ShardingStrategy
      Return the GatewayClientGroupManager to maintain each gateway client in the created group.
      Specified by:
      getGroupManager in interface ShardingStrategy
      Parameters:
      count - the total number of shards
      Returns:
      a GatewayClientGroupManager used by this strategy
    • getMaxConcurrency

      public int getMaxConcurrency()
      Description copied from interface: ShardingStrategy
      Return the number of shards that can be identified concurrently. Must be 1 unless your application is authorized to use the large bot sharding system.
      Specified by:
      getMaxConcurrency in interface ShardingStrategy
      Returns:
      a value determining the sharding factor this strategy has
      See Also: