@Sathish Balasubramaniyan, @Dino
Short answer, yes but with caveat.
Here’s what I’ve found during a recent test, just happened to need this for another project.
- IsFallback works, targets DO get taken out of rotation and fallback target DOES gets used
- When a RoundRobin target comes back on line its added immediately and fallback is not used
- A HealthMonitor is required for the target server to be taken out of rotation
- MaxFailures > 0 with no HealthMonitor does NOT take the target out of rotation
In my test case:
First proxy representing the targets (see target.zip) deployed to different orgs/envs so host is different.
Three target servers configured to the host for each of the target proxies (see management API below to use SSL)
Second proxy configured with HTTPTargetConnection shown below (see targettest.zip)
With this setup I can easily simulate taking the targets out (undeploy the proxy) and observe the responses from the “targettest” proxy. I used a ping response with the proxy host name to see where the response came from (GET /targettest/ping).
With everything running you will see responses from the targettest proxy, switching back and forth between target1 and target2.
When you undeploy target1 and target2 proxies, the fallback target gets used.
NOTE: Here’s the caveat (maybe bug), the targettest proxy must be idle for the time period equal to (MaxFailures X IntervalInSec), 25 seconds in the example, in order for the target to be taken out of rotation. If you keep hitting the targettest proxy you will see error response from the undeployed target proxy since its still in rotation. Once MaxFailures count is reached from the healthcheck call without any other responses from the target, it gets taken out of rotation.
I created an HTTPHealthMonitor as shown below:
<HTTPTargetConnection>
<LoadBalancer>
<Algorithm>RoundRobin</Algorithm>
<Server name="target1"/>
<Server name="target2"/>
<Server name="target3">
<IsFallback>true</IsFallback>
</Server>
<MaxFailures>5</MaxFailures>
</LoadBalancer>
<Path>/target</Path>
<HealthMonitor>
<IsEnabled>true</IsEnabled>
<IntervalInSec>5</IntervalInSec>
<HTTPMonitor>
<Request>
<ConnectTimeoutInSec>10</ConnectTimeoutInSec>
<SocketReadTimeoutInSec>30</SocketReadTimeoutInSec>
<Port>443</Port>
<Verb>GET</Verb>
<Path>/target/healthcheck</Path>
</Request>
<SuccessResponse>
<ResponseCode>200</ResponseCode>
<Header name="ImOK">YourOK</Header>
</SuccessResponse>
</HTTPMonitor>
</HealthMonitor>
</HTTPTargetConnection>
To create the target servers using the management API use:
POST {{MGMTSVR}}/v1/o/{{ORG}}/e/{{ENV}}/targetservers/target1
<TargetServer name="target1">
<Host>yourorgnamehere-test.apigee.net</Host>
<Port>443</Port>
<IsEnabled>true</IsEnabled>
<SSLInfo>
<Enabled>true</Enabled>
</SSLInfo>
</TargetServer>
Attached are the proxies to test this yourself.
target-rev1-2017-05-11.zip
Updated targettest to show error in fault flow, when target proxy is undeployed.
targettest-rev3-2017-05-16.zip