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.HasCamelContext,org.apache.camel.spi.HasId,org.apache.camel.spi.IdAware,org.apache.camel.spi.RouteIdAware,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, org.apache.camel.spi.RouteIdAware
Implementation of Circuit Breaker EIP using resilience4j.
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionResilienceProcessor(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, boolean throwExceptionWhenHalfOpenOrOpenState) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoBuild()protected voidprotected voiddoStart()protected voiddoStop()intlongorg.apache.camel.CamelContextio.github.resilience4j.circuitbreaker.CircuitBreakerfloatintintintfloatlongfloatgetId()intintlongintintintintfloatlongbooleanhasNext()booleanbooleanbooleanbooleanbooleanList<org.apache.camel.Processor> next()booleanprocess(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) voidsetCamelContext(org.apache.camel.CamelContext camelContext) voidsetCircuitBreaker(io.github.resilience4j.circuitbreaker.CircuitBreaker circuitBreaker) voidsetExecutorService(ExecutorService executorService) voidvoidsetRouteId(String routeId) voidsetShutdownExecutorService(boolean shutdownExecutorService) voidvoidvoidvoidMethods inherited from class org.apache.camel.support.AsyncProcessorSupport
process, processAsyncMethods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doInit, doLifecycleChange, doResume, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.spi.IdAware
setGeneratedIdMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
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, boolean throwExceptionWhenHalfOpenOrOpenState)
-
-
Method Details
-
doBuild
- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doShutdown
- Overrides:
doShutdownin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext) - Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
getId
- Specified by:
getIdin interfaceorg.apache.camel.spi.HasId
-
setId
- Specified by:
setIdin interfaceorg.apache.camel.spi.IdAware
-
getRouteId
- Specified by:
getRouteIdin interfaceorg.apache.camel.spi.RouteIdAware
-
setRouteId
- Specified by:
setRouteIdin interfaceorg.apache.camel.spi.RouteIdAware
-
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
-
setExecutorService
-
getTraceLabel
- Specified by:
getTraceLabelin 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
-
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
- Specified by:
nextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) - Specified by:
processin interfaceorg.apache.camel.AsyncProcessor
-