Interface RateLimiterRegistry

All Superinterfaces:
io.github.resilience4j.core.Registry<RateLimiter,RateLimiterConfig>
All Known Implementing Classes:
InMemoryRateLimiterRegistry

public interface RateLimiterRegistry extends io.github.resilience4j.core.Registry<RateLimiter,RateLimiterConfig>
Manages all RateLimiter instances.
  • Method Details

    • of

      static RateLimiterRegistry of(RateLimiterConfig defaultRateLimiterConfig)
      Creates a RateLimiterRegistry with a custom RateLimiter configuration.
      Parameters:
      defaultRateLimiterConfig - a custom RateLimiter configuration
      Returns:
      a RateLimiterRegistry instance backed by a custom RateLimiter configuration
    • of

      static RateLimiterRegistry of(RateLimiterConfig defaultRateLimiterConfig, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer)
      Creates a RateLimiterRegistry with a custom default RateLimiter configuration and a RateLimiter registry event consumer.
      Parameters:
      defaultRateLimiterConfig - a custom default RateLimiter configuration.
      registryEventConsumer - a RateLimiter registry event consumer.
      Returns:
      a RateLimiterRegistry with a custom RateLimiter configuration and a RateLimiter registry event consumer.
    • of

      static RateLimiterRegistry of(RateLimiterConfig defaultRateLimiterConfig, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers)
      Creates a RateLimiterRegistry with a custom default RateLimiter configuration and a list of RateLimiter registry event consumers.
      Parameters:
      defaultRateLimiterConfig - a custom default RateLimiter configuration.
      registryEventConsumers - a list of RateLimiter registry event consumers.
      Returns:
      a RateLimiterRegistry with a custom RateLimiter configuration and a list of RateLimiter registry event consumers.
    • ofDefaults

      static RateLimiterRegistry ofDefaults()
      Returns a managed RateLimiterConfig or creates a new one with a default RateLimiter configuration.
      Returns:
      The RateLimiterConfig
    • of

      Creates a ThreadPoolBulkheadRegistry with a Map of shared RateLimiter configurations.
      Parameters:
      configs - a Map of shared RateLimiter configurations
      Returns:
      a ThreadPoolBulkheadRegistry with a Map of shared RateLimiter configurations.
    • of

      Creates a ThreadPoolBulkheadRegistry with a Map of shared RateLimiter configurations.

      Tags added to the registry will be added to every instance created by this registry.

      Parameters:
      configs - a Map of shared RateLimiter configurations
      tags - default tags to add to the registry
      Returns:
      a ThreadPoolBulkheadRegistry with a Map of shared RateLimiter configurations.
    • of

      static RateLimiterRegistry of(Map<String,RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer)
      Creates a RateLimiterRegistry with a Map of shared RateLimiter configurations and a RateLimiter registry event consumer.
      Parameters:
      configs - a Map of shared RateLimiter configurations.
      registryEventConsumer - a RateLimiter registry event consumer.
      Returns:
      a RateLimiterRegistry with a Map of shared RateLimiter configurations and a RateLimiter registry event consumer.
    • of

      static RateLimiterRegistry of(Map<String,RateLimiterConfig> configs, io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter> registryEventConsumer, Map<String,String> tags)
      Creates a RateLimiterRegistry with a Map of shared RateLimiter configurations and a RateLimiter registry event consumer.
      Parameters:
      configs - a Map of shared RateLimiter configurations.
      registryEventConsumer - a RateLimiter registry event consumer.
      tags - default tags to add to the registry
      Returns:
      a RateLimiterRegistry with a Map of shared RateLimiter configurations and a RateLimiter registry event consumer.
    • of

      static RateLimiterRegistry of(Map<String,RateLimiterConfig> configs, List<io.github.resilience4j.core.registry.RegistryEventConsumer<RateLimiter>> registryEventConsumers)
      Creates a RateLimiterRegistry with a Map of shared RateLimiter configurations and a list of RateLimiter registry event consumers.
      Parameters:
      configs - a Map of shared RateLimiter configurations.
      registryEventConsumers - a list of RateLimiter registry event consumers.
      Returns:
      a RateLimiterRegistry with a Map of shared RateLimiter configurations and a list of RateLimiter registry event consumers.
    • getAllRateLimiters

      Set<RateLimiter> getAllRateLimiters()
      Returns all managed RateLimiter instances.
      Returns:
      all managed RateLimiter instances.
    • rateLimiter

      RateLimiter rateLimiter(String name)
      Returns a managed RateLimiter or creates a new one with the default RateLimiter configuration.
      Parameters:
      name - the name of the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      RateLimiter rateLimiter(String name, Map<String,String> tags)
      Returns a managed RateLimiter or creates a new one with the default RateLimiter configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the RateLimiter
      tags - tags added to the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      RateLimiter rateLimiter(String name, RateLimiterConfig rateLimiterConfig)
      Returns a managed RateLimiter or creates a new one with a custom RateLimiter configuration.
      Parameters:
      name - the name of the RateLimiter
      rateLimiterConfig - a custom RateLimiter configuration
      Returns:
      The RateLimiter
    • rateLimiter

      RateLimiter rateLimiter(String name, RateLimiterConfig rateLimiterConfig, Map<String,String> tags)
      Returns a managed RateLimiter or creates a new one with a custom RateLimiter configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the RateLimiter
      rateLimiterConfig - a custom RateLimiter configuration
      tags - tags added to the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      RateLimiter rateLimiter(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier)
      Returns a managed RateLimiterConfig or creates a new one with a custom RateLimiterConfig configuration.
      Parameters:
      name - the name of the RateLimiterConfig
      rateLimiterConfigSupplier - a supplier of a custom RateLimiterConfig configuration
      Returns:
      The RateLimiterConfig
    • rateLimiter

      RateLimiter rateLimiter(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier, Map<String,String> tags)
      Returns a managed RateLimiterConfig or creates a new one with a custom RateLimiterConfig configuration.

      The tags passed will be appended to the tags already configured for the registry. When tags (keys) of the two collide the tags passed with this method will override the tags of the registry.

      Parameters:
      name - the name of the RateLimiterConfig
      rateLimiterConfigSupplier - a supplier of a custom RateLimiterConfig configuration
      tags - tags added to the RateLimiter
      Returns:
      The RateLimiterConfig
    • rateLimiter

      RateLimiter rateLimiter(String name, String configName)
      Returns a managed RateLimiter or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).
      Parameters:
      name - the name of the RateLimiter
      configName - the name of the shared configuration
      Returns:
      The RateLimiter
    • rateLimiter

      RateLimiter rateLimiter(String name, String configName, Map<String,String> tags)
      Returns a managed RateLimiter or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).
      Parameters:
      name - the name of the RateLimiter
      configName - the name of the shared configuration
      Returns:
      The RateLimiter
    • custom

      static RateLimiterRegistry.Builder custom()
      Returns a builder to create a custom RateLimiterRegistry.
      Returns:
      a RateLimiterRegistry.Builder