Using the Circuit Breaker in an Activity

The Circuit Breaker Pattern is a design pattern used in modern microservice architectures to prevent an application from repeatedly attempting an operation that is likely to fail. This is critical when services rely on remote calls to other services or external resources, as a failing service can quickly cascade failures across the entire system (the "snowball effect"). By detecting failures and automatically preventing subsequent calls for a configured duration, it gives the failing service time to recover and conserves system resources.

The Three States of a Circuit Breaker

A circuit breaker operates by transitioning between three distinct states as described in the following table.

State Behavior Transition
Closed The default operational state. Requests pass through to the target service as normal. If the rate of failures (exceptions, timeouts, or network issues) exceeds the configured threshold within a specified time window, the circuit breaker trips and transitions to the Open state.
Open All requests are immediately rejected by the circuit breaker and return a failure/fallback response without attempting to call the target service. After a specified timeout period (the retry timeout), the circuit breaker transitions to the Half-Open state to test if the service has recovered.
Half-Open A limited number of test requests are allowed to pass through to the target service.
  • If the test requests succeed, the service is considered recovered, and the breaker transitions back to the Closed state.

  • If any of the test requests fail, the circuit breaker transitions immediately back to the Open state, resetting the retry timeout.

You can set the circuit breaker configuration values in one of the following ways:

  • Manually type the value in the mapper

  • Map the value from the previous Activity

  • Map app property to override the values

Circuit Breaker Configuration

Name Type Required Default Description
enabled

Boolean

Yes false To enable Circuit Breaker feature, set this to true
name String Yes None Name of the Circuit Breaker
waitDurationInOpenState Integer Yes None The time required for the Circuit Breaker to wait before transitioning from open to half-open. For example, when set to 60000, the circuit is in the open state for 60 seconds, after which the circuit breaker transitions to the Half-Open state and a request is sent.
failureRate Float Yes None This property configures the rate of failure in percentage in a given rolling window duration. When the rate of failure is equal or greater than the set value, the circuit trips and transitions to an open state. For example, when set to 50, circuit trips when 50% of total requests sent during the rolling window duration have failed.
minimumRequests Integer Yes None This property configures the minimum number of requests that are required (per rolling window duration) before the Circuit Breaker can calculate the failure rate. For example, if the minimumRequests value is 10, then at least 10 requests must be recorded before the failure rate can be calculated. If only 9 requests have been recorded, then the Circuit Breaker does not transition to open even if all 9 calls have failed.
maxRequestsAllowed Integer No 1 This property configures the maximum number of requests permitted when the Circuit Breaker is in the Half-Open state. The default value is 1.
rollingWindowDuration Integer Yes None This property configures the time duration in milliseconds for the rolling window strategy. The counts are updated and reset gradually after completion of the window. For example, if set to 60000 milliseconds (1 min) and the failure rate is 50, the failure rate is calculated only for the failures within the 1-minute period.