Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CircuitBreakerOptions

Circuit breaker configuration options. All time are given in milliseconds.

Hierarchy

  • CircuitBreakerOptions

Index

Constructors

constructor

Methods

getFailuresRollingWindow

  • getFailuresRollingWindow(): number
  • Sets the rolling window used for metrics.

    Returns number

getMaxFailures

  • getMaxFailures(): number
  • Sets the maximum number of failures before opening the circuit.

    Returns number

getMaxRetries

  • getMaxRetries(): number
  • Configures the number of times the circuit breaker tries to redo the operation before failing.

    Returns number

getMetricsRollingBuckets

  • getMetricsRollingBuckets(): number
  • Sets the configured number of buckets the rolling window is divided into.

    The following must be true - metrics.rollingStats.timeInMilliseconds % metrics.rollingStats.numBuckets == 0 - otherwise it will throw an exception.

    In other words, 10000/10 is okay, so is 10000/20 but 10000/7 is not.

    Returns number

getMetricsRollingWindow

  • getMetricsRollingWindow(): number
  • Sets the rolling window used for metrics.

    Returns number

getNotificationAddress

  • getNotificationAddress(): string
  • Sets the event bus address on which the circuit breaker publish its state change.

    Returns string

getNotificationPeriod

  • getNotificationPeriod(): number
  • Configures the period in milliseconds where the circuit breaker send a notification on the event bus with its current state.

    Returns number

getResetTimeout

  • getResetTimeout(): number
  • Sets the time in ms before it attempts to re-close the circuit (by going to the half-open state). If the circuit is closed when the timeout is reached, nothing happens. -1 disables this feature.

    Returns number

getTimeout

  • getTimeout(): number
  • Sets the timeout in milliseconds. If an action is not completed before this timeout, the action is considered as a failure.

    Returns number

isFallbackOnFailure

  • isFallbackOnFailure(): boolean
  • Sets whether or not the fallback is executed on failure, even when the circuit is closed.

    Returns boolean

isNotificationLocalOnly

  • isNotificationLocalOnly(): boolean
  • Whether circuit breaker state should be delivered only to local consumers.

    Returns boolean

setFailuresRollingWindow

  • Sets the rolling window used for metrics.

    Parameters

    • failuresRollingWindow: number

    Returns CircuitBreakerOptions

setFallbackOnFailure

  • Sets whether or not the fallback is executed on failure, even when the circuit is closed.

    Parameters

    • fallbackOnFailure: boolean

    Returns CircuitBreakerOptions

setMaxFailures

  • Sets the maximum number of failures before opening the circuit.

    Parameters

    • maxFailures: number

    Returns CircuitBreakerOptions

setMaxRetries

  • Configures the number of times the circuit breaker tries to redo the operation before failing.

    Parameters

    • maxRetries: number

    Returns CircuitBreakerOptions

setMetricsRollingBuckets

  • Sets the configured number of buckets the rolling window is divided into.

    The following must be true - metrics.rollingStats.timeInMilliseconds % metrics.rollingStats.numBuckets == 0 - otherwise it will throw an exception.

    In other words, 10000/10 is okay, so is 10000/20 but 10000/7 is not.

    Parameters

    • metricsRollingBuckets: number

    Returns CircuitBreakerOptions

setMetricsRollingWindow

  • Sets the rolling window used for metrics.

    Parameters

    • metricsRollingWindow: number

    Returns CircuitBreakerOptions

setNotificationAddress

  • Sets the event bus address on which the circuit breaker publish its state change.

    Parameters

    • notificationAddress: string

    Returns CircuitBreakerOptions

setNotificationLocalOnly

  • Whether circuit breaker state should be delivered only to local consumers.

    Parameters

    • notificationLocalOnly: boolean

    Returns CircuitBreakerOptions

setNotificationPeriod

  • Configures the period in milliseconds where the circuit breaker send a notification on the event bus with its current state.

    Parameters

    • notificationPeriod: number

    Returns CircuitBreakerOptions

setResetTimeout

  • Sets the time in ms before it attempts to re-close the circuit (by going to the half-open state). If the circuit is closed when the timeout is reached, nothing happens. -1 disables this feature.

    Parameters

    • resetTimeout: number

    Returns CircuitBreakerOptions

setTimeout

  • Sets the timeout in milliseconds. If an action is not completed before this timeout, the action is considered as a failure.

    Parameters

    • timeout: number

    Returns CircuitBreakerOptions

toJson

  • toJson(): {}
  • Returns {}

    • [key: string]: any

Generated using TypeDoc