Şöyle yaparız
management:health:circuitbreakers:enabled: trueendpoints:web:exposure:include: healthendpoint:health:show-details: alwaysresilience4j:circuitbreaker:instances:callerService:registerHealthIndicator: trueeventConsumerBufferSize: 10failureRateThreshold: 10minimumNumberOfCalls: 5automaticTransitionFromOpenToHalfOpenEnabled: truewaitDurationInOpenState: 5spermittedNumberOfCallsInHalfOpenState: 3slidingWindowSize: 10slidingWindowType: COUNT_BASED
Açıklaması şöyle
- registerHealthIndicator: true: This line is telling the service to register a health indicator, which can be used to monitor the overall health of the service.- eventConsumerBufferSize: 10: This is the size of the buffer that will store events from the Circuit Breaker.- failureRateThreshold: 10: This is the threshold for the failure rate of calls. If the failure rate of calls exceeds this threshold, the Circuit Breaker will trip.- minimumNumberOfCalls: 5: This is the minimum number of calls that the Circuit Breaker will monitor before it starts tripping.- automaticTransitionFromOpenToHalfOpenEnabled: true: This line enables automatic transition from the open state to the half-open state after the wait duration has elapsed.- waitDurationInOpenState: 5s: This is the duration that the Circuit Breaker will wait in the open state before attempting to automatically transition to the half-open state.- permittedNumberOfCallsInHalfOpenState: 3: This is the maximum number of calls that the Circuit Breaker will allow in the half-open state.- slidingWindowSize: 10: This is the size of the sliding window that the Circuit Breaker will use to monitor calls.- slidingWindowType: COUNT_BASED: This line specifies the type of sliding window that the Circuit Breaker will use, which in this case is a count-based sliding window. There are other options for slidingWindowType like TIME_BASED, TIME_BASED_RESET etc which can be used for specific use cases.
Örnek
application.properties dosyası şöyledir
resilience4j: circuitbreaker: instances: mockService: slidingWindowSize: 3 slidingWindowType: COUNT_BASED #waitDurationInOpenState: 5 waitInterval: 10000 failureRateThreshold: 50 permittedNumberOfCallsInHalfOpenState: 5 registerHealthIndicator: true #register-health-indicator: true allowHealthIndicatorToFail: true configs: default: registerHealthIndicator: true
Hiç yorum yok:
Yorum Gönder