[feature-14304]Making system.util.retarget() Failover Aware

What would be the best way to have system.util.retarget() check if the IP address is up before retargetting, and then if the server is on its failover, then retarget to the failover server instead?

httpGet http://address:port/system/gwinfo (if 7.9 or earlier, http://address:port/main/system/gwinfo) and parse the response info for the redundancy information/backup addresses.

Would something simple like this work?

primaryurl = "http://10.XX.XX.XX:8088/main/"

secondaryurl = "http://10.XX.XX.XX:8088/main/"


system.util.retarget("Main", primaryurl)


system.util.retarget("Main", secondaryurl)

Retarget won’t throw an exception back, I’m pretty confident - it will kick off the mechanism to retarget, then leave the client in a broken state. You’ll have to proactively check that the client is there. Normally our backup/failover is transparent, but retargetting has no way to know that it needs to ask for backup addresses. I can add a feature request to see if maybe we could extend retarget to allow a list of addresses, which will be attempted in order.

That sounds like a better approach. httpGet should throw an exception.

1 Like