Class InMemoryRateLimiterRegistry

java.lang.Object
io.github.resilience4j.core.registry.AbstractRegistry<RateLimiter,​RateLimiterConfig>
io.github.resilience4j.ratelimiter.internal.InMemoryRateLimiterRegistry
All Implemented Interfaces:
io.github.resilience4j.core.Registry<RateLimiter,​RateLimiterConfig>, RateLimiterRegistry

public class InMemoryRateLimiterRegistry
extends io.github.resilience4j.core.registry.AbstractRegistry<RateLimiter,​RateLimiterConfig>
implements RateLimiterRegistry
Backend RateLimiter manager. Constructs backend RateLimiters according to configuration values.
  • Constructor Details

  • Method Details

    • getAllRateLimiters

      public io.vavr.collection.Seq<RateLimiter> getAllRateLimiters()
      Returns all managed RateLimiter instances.
      Specified by:
      getAllRateLimiters in interface RateLimiterRegistry
      Returns:
      all managed RateLimiter instances.
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name)
      Returns a managed RateLimiter or creates a new one with the default RateLimiter configuration.
      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, io.vavr.collection.Map<java.lang.String,​java.lang.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.

      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      tags - tags added to the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, RateLimiterConfig config)
      Returns a managed RateLimiter or creates a new one with a custom RateLimiter configuration.
      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      config - a custom RateLimiter configuration
      Returns:
      The RateLimiter
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, RateLimiterConfig config, io.vavr.collection.Map<java.lang.String,​java.lang.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.

      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      config - a custom RateLimiter configuration
      tags - tags added to the RateLimiter
      Returns:
      The RateLimiter
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, java.util.function.Supplier<RateLimiterConfig> rateLimiterConfigSupplier)
      Returns a managed RateLimiterConfig or creates a new one with a custom RateLimiterConfig configuration.
      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiterConfig
      rateLimiterConfigSupplier - a supplier of a custom RateLimiterConfig configuration
      Returns:
      The RateLimiterConfig
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, java.util.function.Supplier<RateLimiterConfig> rateLimiterConfigSupplier, io.vavr.collection.Map<java.lang.String,​java.lang.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.

      Specified by:
      rateLimiter in interface RateLimiterRegistry
      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

      public RateLimiter rateLimiter​(java.lang.String name, java.lang.String configName)
      Returns a managed RateLimiter or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).
      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      configName - the name of the shared configuration
      Returns:
      The RateLimiter
    • rateLimiter

      public RateLimiter rateLimiter​(java.lang.String name, java.lang.String configName, io.vavr.collection.Map<java.lang.String,​java.lang.String> tags)
      Returns a managed RateLimiter or creates a new one. The configuration must have been added upfront via Registry.addConfiguration(String, Object).
      Specified by:
      rateLimiter in interface RateLimiterRegistry
      Parameters:
      name - the name of the RateLimiter
      configName - the name of the shared configuration
      Returns:
      The RateLimiter