Class ResilienceProcessor
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.support.AsyncProcessorSupport
-
- org.apache.camel.component.resilience4j.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 Summary
Constructors Constructor Description 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 Summary
-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
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 interfaceorg.apache.camel.CamelContextAware
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
getId
public String getId()
- Specified by:
getId
in interfaceorg.apache.camel.spi.HasId
-
setId
public void setId(String id)
- Specified by:
setId
in interfaceorg.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)
-
getExecutorService
public ExecutorService getExecutorService()
-
setExecutorService
public void setExecutorService(ExecutorService executorService)
-
getTraceLabel
public String getTraceLabel()
- Specified by:
getTraceLabel
in interfaceorg.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 interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceorg.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 interfaceorg.apache.camel.AsyncProcessor
-
doStart
protected void doStart() throws Exception
- Overrides:
doStart
in classorg.apache.camel.support.AsyncProcessorSupport
- Throws:
Exception
-
-