Md Shadab Ali
Md Shadab Ali

Reputation: 23

Fallback Method for Circuit Breaker in Spring Integration

I am trying to implement circuit breaker while calling soap service using spring integration . Circuit Breaker is working as expected. Problem is i need to implement fallback mechanism when circuit is open . Please suggest the possible the way to implement it .

spring-integartion.xml

<int:chain input-channel="BLR" output-channel="location.reply.out" >
        <ws:header-enricher>
            <ws:soap-action value="${bangalore-service.quote.soap.action.value}"/>
        </ws:header-enricher>

        <ws:outbound-gateway uri="#{locationDetailsProperties.getBlrServiceEndPoint()}">
             <ws:request-handler-advice-chain>
               <bean class="org.springframework.integration.handler.advice.RequestHandlerCircuitBreakerAdvice">
                    <property name="threshold" value="3" />
                    <property name="halfOpenAfter" value="60000" /> 
               </bean>
            </ws:request-handler-advice-chain>
        </ws:outbound-gateway>    
    </int:chain>

Upvotes: 0

Views: 297

Answers (1)

Gary Russell
Gary Russell

Reputation: 174554

You need to show your upstream flow.

You should add an error channel to whatever starts the flow and subscribe an error handling flow to it; the ErrorMessage payload is a messaging exception with failedMessage and cause properties, scan the cause tree to look for a CircuitBreakerOpenException.

Upvotes: 1

Related Questions