Circuit breaker in Apigee Public cloud

Hi, I am trying to implement Apigee circuit breaker using MaxFailures and HealthMonitor in Traget but its not working. Here is the below code and error . Please suggest.

<LoadBalancer>

<Server name="XXXXXX"/>

<MaxFailures>2</MaxFailures>

<ServerUnhealthyResponse>

<ResponseCode>503</ResponseCode>

<ResponseCode>504</ResponseCode>

<ResponseCode>500</ResponseCode>

</ServerUnhealthyResponse>

</LoadBalancer>

<Path>{targetpath}</Path>

<HealthMonitor>

<IsEnabled>true</IsEnabled>

<IntervalInSec>5</IntervalInSec>

<HTTPMonitor>

<Request>

<ConnectTimeoutInSec>10</ConnectTimeoutInSec>

<SocketReadTimeoutInSec>30</SocketReadTimeoutInSec>

<Port>80</Port>

<Verb>GET</Verb>

<Path>{targetpath}</Path>

</Request>

<SuccessResponse>

<ResponseCode>200</ResponseCode>

<Header name="ImOK">YourOK</Header>

</SuccessResponse>

</HTTPMonitor>

</HealthMonitor>

</HTTPTargetConnection>


Error getting:

Always the below getting even the Target server is giving 200 OK :

{"fault":{"faultstring":"The Service is temporarily unavailable","detail":{"errorcode":"messaging.adaptors.http.flow.NoActiveTargets"}}}

0 4 980
4 REPLIES 4

I believe you can not specify variables in health monitors.

There is target path variable in health monitor.

I removed , give a physical path but still same error. Could not find out where is the issue as I am using cloud version. Please suggest.

<HealthMonitor> <IsEnabled>true</IsEnabled> <IntervalInSec>5</IntervalInSec> <HTTPMonitor> <Request> <ConnectTimeoutInSec>10</ConnectTimeoutInSec> <SocketReadTimeoutInSec>10</SocketReadTimeoutInSec> <Port>80</Port> <Verb>POST</Verb> <Path>mem/web/login/v3/memlogin</Path> </Request> <SuccessResponse> <ResponseCode>200</ResponseCode> <Header name="ImOK">YourOK</Header> </SuccessResponse> </HTTPMonitor> </HealthMonitor>

Some things to check

- Are you setting the customer header ImOK per your health monitor configuration? Otherwise just look at the response code?

- Double check the path, I would have expected a leading /

- You're doing a POST to this endpoint? Is that correct, rather than a GET?

I removed the header part , just pass the response code . Also added / in path . But still getting NoActiveTargets error.

What I did , 1st time ,make my target API throw 504 timeout error . once the maxfailure reach more than 2 , then bringing up the target API to give 200.

While trace I saw its failing after the target flow started , while the target API is 504.

<LoadBalancer>

<Server name="XXXXXX"/>

<MaxFailures>2</MaxFailures>

<ServerUnhealthyResponse>

<ResponseCode>503</ResponseCode>

<ResponseCode>504</ResponseCode>

<ResponseCode>500</ResponseCode>

</ServerUnhealthyResponse>

</LoadBalancer><Path>{targetpath}</Path>

<HealthMonitor> <IsEnabled>true</IsEnabled> <IntervalInSec>5</IntervalInSec> <HTTPMonitor> <Request> <ConnectTimeoutInSec>10</ConnectTimeoutInSec> <SocketReadTimeoutInSec>10</SocketReadTimeoutInSec> <Port>80</Port> <Verb>POST</Verb> <Path>/mem/web/login/v3/memlogin</Path> </Request> <SuccessResponse> <ResponseCode>200</ResponseCode> </SuccessResponse> </HTTPMonitor> </HealthMonitor>

Please suggest.