Class BaseResilientExchangeService<E extends Exchange>

    • Constructor Detail

      • BaseResilientExchangeService

        protected BaseResilientExchangeService​(E exchange,
                                               ResilienceRegistries resilienceRegistries)
    • Method Detail

      • decorateApiCall

        public <R> ResilienceUtils.DecorateCallableApi<R> decorateApiCall​(ResilienceUtils.CallableApi<R> callable)
        Use this method to decorate API calls with resiliency features like retries, rate limiters, etc.
        Type Parameters:
        R - type returned by the API call
        Parameters:
        callable - call to exchange API
        Returns:
        builder of a decorated API call
      • retry

        protected io.github.resilience4j.retry.Retry retry​(String name)
        Returns a managed Retry or creates a new one with the default Retry configuration from ResilienceRegistries.DEFAULT_RETRY_CONFIG.
        Parameters:
        name - the name of the Retry
        Returns:
        The Retry
        See Also:
        RetryRegistry.retry(String)
      • rateLimiter

        protected io.github.resilience4j.ratelimiter.RateLimiter rateLimiter​(String name)
        Returns a managed RateLimiter or creates a new one with the default RateLimiter configuration. One main shared rate limiter should be defined for each exchange module via ResilienceRegistries.rateLimiters() ()} and the Registry.addConfiguration(String, Object) method.
        Parameters:
        name - the name of the RateLimiter
        Returns:
        The RateLimiter
        See Also:
        RateLimiterRegistry.rateLimiter(String)
      • rateLimiter

        protected io.github.resilience4j.ratelimiter.RateLimiter rateLimiter​(String name,
                                                                             String configName)
        Returns a managed RateLimiter or creates a new one. The configuration must have been added upfront resilienceRegistries via ResilienceRegistries.rateLimiters() ()} and the Registry.addConfiguration(String, Object) method.
        Parameters:
        name - the name of the RateLimiter
        configName - the name of the shared configuration
        Returns:
        The RateLimiter
        See Also:
        RateLimiterRegistry.rateLimiter(String, String)