Class ResilienceProcessor

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.AsyncProcessor, org.apache.camel.CamelContextAware, org.apache.camel.Navigate<org.apache.camel.Processor>, org.apache.camel.Processor, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.HasId, org.apache.camel.spi.IdAware, org.apache.camel.StatefulService, org.apache.camel.SuspendableService, org.apache.camel.Traceable

    @ManagedResource(description="Managed Resilience Processor")
    public class ResilienceProcessor
    extends org.apache.camel.support.AsyncProcessorSupport
    implements org.apache.camel.CamelContextAware, org.apache.camel.Navigate<org.apache.camel.Processor>, org.apache.camel.Traceable, org.apache.camel.spi.IdAware
    Implementation of Circuit Breaker EIP using resilience4j.
    • Constructor Detail

      • ResilienceProcessor

        public ResilienceProcessor​(io.github.resilience4j.circuitbreaker.CircuitBreakerConfig circuitBreakerConfig,
                                   io.github.resilience4j.bulkhead.BulkheadConfig bulkheadConfig,
                                   io.github.resilience4j.timelimiter.TimeLimiterConfig timeLimiterConfig,
                                   org.apache.camel.Processor processor,
                                   org.apache.camel.Processor fallback)
    • Method Detail

      • getCamelContext

        public org.apache.camel.CamelContext getCamelContext()
        Specified by:
        getCamelContext in interface org.apache.camel.CamelContextAware
      • setCamelContext

        public void setCamelContext​(org.apache.camel.CamelContext camelContext)
        Specified by:
        setCamelContext in interface org.apache.camel.CamelContextAware
      • getId

        public String getId()
        Specified by:
        getId in interface org.apache.camel.spi.HasId
      • setId

        public void setId​(String id)
        Specified by:
        setId in interface org.apache.camel.spi.IdAware
      • getCircuitBreaker

        public io.github.resilience4j.circuitbreaker.CircuitBreaker getCircuitBreaker()
      • setCircuitBreaker

        public void setCircuitBreaker​(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker)
      • isShutdownExecutorService

        public boolean isShutdownExecutorService()
      • setShutdownExecutorService

        public void setShutdownExecutorService​(boolean shutdownExecutorService)
      • setExecutorService

        public void setExecutorService​(ExecutorService executorService)
      • getTraceLabel

        public String getTraceLabel()
        Specified by:
        getTraceLabel in interface org.apache.camel.Traceable
      • getFailureRate

        @ManagedAttribute(description="Returns the current failure rate in percentage.")
        public float getFailureRate()
      • getSlowCallRate

        @ManagedAttribute(description="Returns the current percentage of calls which were slower than a certain threshold.")
        public float getSlowCallRate()
      • getNumberOfSlowCalls

        @ManagedAttribute(description="Returns the current total number of calls which were slower than a certain threshold.")
        public int getNumberOfSlowCalls()
      • getNumberOfSlowSuccessfulCalls

        @ManagedAttribute(description="Returns the current number of successful calls which were slower than a certain threshold.")
        public int getNumberOfSlowSuccessfulCalls()
      • getNumberOfSlowFailedCalls

        @ManagedAttribute(description="Returns the current number of failed calls which were slower than a certain threshold.")
        public int getNumberOfSlowFailedCalls()
      • getNumberOfBufferedCalls

        @ManagedAttribute(description="Returns the current total number of buffered calls in the ring buffer.")
        public int getNumberOfBufferedCalls()
      • getNumberOfFailedCalls

        @ManagedAttribute(description="Returns the current number of failed buffered calls in the ring buffer.")
        public int getNumberOfFailedCalls()
      • getNumberOfSuccessfulCalls

        @ManagedAttribute(description="Returns the current number of successful buffered calls in the ring buffer")
        public int getNumberOfSuccessfulCalls()
      • getNumberOfNotPermittedCalls

        @ManagedAttribute(description="Returns the current number of not permitted calls, when the state is OPEN.")
        public long getNumberOfNotPermittedCalls()
      • getCircuitBreakerState

        @ManagedAttribute(description="Returns the current state of the circuit breaker")
        public String getCircuitBreakerState()
      • transitionToCloseState

        @ManagedOperation(description="Transitions the circuit breaker to CLOSED state.")
        public void transitionToCloseState()
      • transitionToOpenState

        @ManagedOperation(description="Transitions the circuit breaker to OPEN state.")
        public void transitionToOpenState()
      • transitionToHalfOpenState

        @ManagedOperation(description="Transitions the circuit breaker to HALF_OPEN state.")
        public void transitionToHalfOpenState()
      • transitionToForcedOpenState

        @ManagedOperation(description="Transitions the state machine to a FORCED_OPEN state, stopping state transition, metrics and event publishing.")
        public void transitionToForcedOpenState()
      • getCircuitBreakerFailureRateThreshold

        @ManagedAttribute
        public float getCircuitBreakerFailureRateThreshold()
      • getCircuitBreakerSlowCallRateThreshold

        @ManagedAttribute
        public float getCircuitBreakerSlowCallRateThreshold()
      • getCircuitBreakerMinimumNumberOfCalls

        @ManagedAttribute
        public int getCircuitBreakerMinimumNumberOfCalls()
      • getCircuitBreakerPermittedNumberOfCallsInHalfOpenState

        @ManagedAttribute
        public int getCircuitBreakerPermittedNumberOfCallsInHalfOpenState()
      • getCircuitBreakerSlidingWindowSize

        @ManagedAttribute
        public int getCircuitBreakerSlidingWindowSize()
      • getCircuitBreakerSlidingWindowType

        @ManagedAttribute
        public String getCircuitBreakerSlidingWindowType()
      • getCircuitBreakerWaitDurationInOpenState

        @ManagedAttribute
        public long getCircuitBreakerWaitDurationInOpenState()
      • isCircuitBreakerTransitionFromOpenToHalfOpenEnabled

        @ManagedAttribute
        public boolean isCircuitBreakerTransitionFromOpenToHalfOpenEnabled()
      • isCircuitBreakerWritableStackTraceEnabled

        @ManagedAttribute
        public boolean isCircuitBreakerWritableStackTraceEnabled()
      • isBulkheadEnabled

        @ManagedAttribute
        public boolean isBulkheadEnabled()
      • getBulkheadMaxConcurrentCalls

        @ManagedAttribute
        public int getBulkheadMaxConcurrentCalls()
      • getBulkheadMaxWaitDuration

        @ManagedAttribute
        public long getBulkheadMaxWaitDuration()
      • isTimeoutEnabled

        @ManagedAttribute
        public boolean isTimeoutEnabled()
      • getTimeoutDuration

        @ManagedAttribute
        public long getTimeoutDuration()
      • next

        public List<org.apache.camel.Processor> next()
        Specified by:
        next in interface org.apache.camel.Navigate<org.apache.camel.Processor>
      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface org.apache.camel.Navigate<org.apache.camel.Processor>
      • process

        public boolean process​(org.apache.camel.Exchange exchange,
                               org.apache.camel.AsyncCallback callback)
        Specified by:
        process in interface org.apache.camel.AsyncProcessor
      • doStart

        protected void doStart()
                        throws Exception
        Overrides:
        doStart in class org.apache.camel.support.AsyncProcessorSupport
        Throws:
        Exception
      • doStop

        protected void doStop()
                       throws Exception
        Overrides:
        doStop in class org.apache.camel.support.AsyncProcessorSupport
        Throws:
        Exception