Class RequestHandlerCircuitBreakerAdvice
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice
org.springframework.integration.handler.advice.RequestHandlerCircuitBreakerAdvice
- All Implemented Interfaces:
- Advice,- Interceptor,- MethodInterceptor,- Aware,- BeanFactoryAware,- BeanNameAware,- InitializingBean,- ApplicationContextAware,- ComponentSourceAware,- ExpressionCapable,- NamedComponent
A circuit breaker that stops calling a failing service after threshold
 failures, until halfOpenAfter milliseconds has elapsed. A successful
 call resets the failure counter.
- Since:
- 2.2
- Author:
- Gary Russell, Artem Bilan, Trung Pham
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classAn exception thrown when the circuit breaker is in an open state.Nested classes/interfaces inherited from class org.springframework.integration.handler.advice.AbstractRequestHandlerAdviceAbstractRequestHandlerAdvice.ExecutionCallback, AbstractRequestHandlerAdvice.ThrowableHolderException
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intA half-open duration as 1000 .static final intA default failures threshold as 5.Fields inherited from class org.springframework.integration.context.IntegrationObjectSupportEXPRESSION_PARSER, logger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ObjectdoInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Subclasses implement this method to apply behavior to theMessageHandler.voidsetHalfOpenAfter(long halfOpenAfter) voidsetThreshold(int threshold) Methods inherited from class org.springframework.integration.handler.advice.AbstractRequestHandlerAdviceinvoke, unwrapExceptionIfNecessary, unwrapThrowableIfNecessaryMethods inherited from class org.springframework.integration.context.IntegrationObjectSupportafterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getComponentType, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
- 
Field Details- 
DEFAULT_THRESHOLDpublic static final int DEFAULT_THRESHOLDA default failures threshold as 5.- See Also:
 
- 
DEFAULT_HALF_OPEN_AFTERpublic static final int DEFAULT_HALF_OPEN_AFTERA half-open duration as 1000 .- See Also:
 
 
- 
- 
Constructor Details- 
RequestHandlerCircuitBreakerAdvicepublic RequestHandlerCircuitBreakerAdvice()
 
- 
- 
Method Details- 
setThresholdpublic void setThreshold(int threshold) 
- 
setHalfOpenAfterpublic void setHalfOpenAfter(long halfOpenAfter) 
- 
doInvokeprotected Object doInvoke(AbstractRequestHandlerAdvice.ExecutionCallback callback, Object target, Message<?> message) Description copied from class:AbstractRequestHandlerAdviceSubclasses implement this method to apply behavior to theMessageHandler.callback.execute() invokes the handler method and returns its result, or null. - Specified by:
- doInvokein class- AbstractRequestHandlerAdvice
- Parameters:
- callback- Subclasses invoke the execute() method on this interface to invoke the handler method.
- target- The target handler.
- message- The message that will be sent to the handler.
- Returns:
- the result after invoking the MessageHandler.
 
 
-