Genesys CTI User Forum

Genesys CTI User Forum => Genesys-related Development => Topic started by: oceanblue on July 16, 2019, 06:02:25 AM

Title: How to find the other HA pair when the Backup is running as Primary?
Post by: oceanblue on July 16, 2019, 06:02:25 AM
I am trying to find a way to determine the HA pair of an application.

It is easier when the [b]Original Primary[/b] is running in the [b]Primary mode[/b], one can simply construct the "[b]CfgApplicationQuery[/b]" to read the application related config object.

However, things are not so trivial (at least to me) when the [b]original Backup[/b] app is running as [b]Primary[/b]. Any idea how to find the [b]Backup app[/b] ([b]original primary[/b]) in that case?

Thanks in advance!

Cheers
Title: Re: How to find the other HA pair when the Backup is running as Primary?
Post by: jamesmurphyau on July 16, 2019, 09:19:52 AM
You might be able to do this with an XPath query.. you can do some quite complex queries with XPath.. if I find time and work it out I'll update this post
Title: Re: How to find the other HA pair when the Backup is running as Primary?
Post by: jamesmurphyau on July 17, 2019, 12:53:22 AM
Yep you can do it with XPath

Assume the backup application DBID is 417, the below code will give you the primary for that backup.

[code]
RequestReadObjects2.create(CfgObjectType.CFGApplication.ordinal, "CfgServer[backupServerDBID/DBID=417]")
[/code]
Title: Re: How to find the other HA pair when the Backup is running as Primary?
Post by: hsujdik on July 24, 2019, 01:37:06 AM
Check if the filter backup_server_dbid works for you:
https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgApplication
Title: Re: How to find the other HA pair when the Backup is running as Primary?
Post by: jamesmurphyau on July 24, 2019, 02:52:08 AM
Actually that's a much better way and it's available natively to CfgApplicationQuery

[code]
val query = new CfgApplicationQuery();
query.setBackupServerDbid(417);
service.retrieveObject(classOf[CfgApplication], query);
[/code]

(code is Scala, but same thing applies to Java/.NET)
Title: Re: How to find the other HA pair when the Backup is running as Primary?
Post by: oceanblue on May 09, 2020, 08:53:41 PM
Thank you so much @jamesmurphyau and @hsujdik !

My sincere apologies for responding so..so late. I been pulled into a different project.

The "backup_server_dbid" filter along with the setBackupServerDbid() method did it for us.

Thanks again!

cheers,