diff --git a/bridge/src/integration-test/kotlin/net/corda/bridge/BridgeIntegrationTest.kt b/bridge/src/integration-test/kotlin/net/corda/bridge/BridgeIntegrationTest.kt index 358eacb190..840915fccc 100644 --- a/bridge/src/integration-test/kotlin/net/corda/bridge/BridgeIntegrationTest.kt +++ b/bridge/src/integration-test/kotlin/net/corda/bridge/BridgeIntegrationTest.kt @@ -192,7 +192,7 @@ class BridgeIntegrationTest { val bridgeFolder = tempFolder.root.toPath() val bridgeConfigResource = "/net/corda/bridge/hawithfloat/bridge/bridge.conf" val bridgeConfig = createAndLoadConfigFromResource(bridgeFolder, bridgeConfigResource) - assertEquals(BridgeHAConfigImpl("zk://localhost:11105", 10), bridgeConfig.haConfig) + assertEquals(BridgeHAConfigImpl("zk://localhost:11105", 20, "/custom/bridge/ha"), bridgeConfig.haConfig) bridgeConfig.createBridgeKeyStores(DUMMY_BANK_A_NAME) createNetworkParams(bridgeFolder) val floatFolder = tempFolder.root.toPath() / "float" @@ -226,7 +226,7 @@ class BridgeIntegrationTest { assertEquals(true, bridge.active) assertEquals(true, float.active) assertEquals(true, serverListening("localhost", 10005)) - val higherPriorityClient = ZkClient("localhost:11105", "/bridge/ha", "Test", 5) + val higherPriorityClient = ZkClient("localhost:11105", "/custom/bridge/ha", "Test", 5) higherPriorityClient.start() higherPriorityClient.requestLeadership() // should win leadership and kick out our bridge assertEquals(false, bridgeStateFollower.next()) diff --git a/bridge/src/main/kotlin/net/corda/bridge/services/api/BridgeConfiguration.kt b/bridge/src/main/kotlin/net/corda/bridge/services/api/BridgeConfiguration.kt index dffb14bb2e..a7e37f524f 100644 --- a/bridge/src/main/kotlin/net/corda/bridge/services/api/BridgeConfiguration.kt +++ b/bridge/src/main/kotlin/net/corda/bridge/services/api/BridgeConfiguration.kt @@ -87,6 +87,7 @@ interface BridgeInnerConfiguration { interface BridgeHAConfig { val haConnectionString: String val haPriority: Int + val haTopic: String } /** diff --git a/bridge/src/main/kotlin/net/corda/bridge/services/config/BridgeConfigurationImpl.kt b/bridge/src/main/kotlin/net/corda/bridge/services/config/BridgeConfigurationImpl.kt index 625e399cb8..ec3ab87b18 100644 --- a/bridge/src/main/kotlin/net/corda/bridge/services/config/BridgeConfigurationImpl.kt +++ b/bridge/src/main/kotlin/net/corda/bridge/services/config/BridgeConfigurationImpl.kt @@ -51,7 +51,7 @@ data class FloatOuterConfigurationImpl(override val floatAddress: NetworkHostAnd override val expectedCertificateSubject: CordaX500Name, override val customSSLConfiguration: BridgeSSLConfigurationImpl?) : FloatOuterConfiguration -data class BridgeHAConfigImpl(override val haConnectionString: String, override val haPriority: Int = 10) : BridgeHAConfig +data class BridgeHAConfigImpl(override val haConnectionString: String, override val haPriority: Int = 10, override val haTopic: String = "/bridge/ha") : BridgeHAConfig data class BridgeConfigurationImpl( override val baseDirectory: Path, diff --git a/bridge/src/main/kotlin/net/corda/bridge/services/ha/ExternalMasterElectionService.kt b/bridge/src/main/kotlin/net/corda/bridge/services/ha/ExternalMasterElectionService.kt index f9a2afedb2..bb043cae0f 100644 --- a/bridge/src/main/kotlin/net/corda/bridge/services/ha/ExternalMasterElectionService.kt +++ b/bridge/src/main/kotlin/net/corda/bridge/services/ha/ExternalMasterElectionService.kt @@ -45,7 +45,7 @@ class ExternalMasterElectionService(val conf: BridgeConfiguration, val info = ManagementFactory.getRuntimeMXBean() val pid = info.name.split("@").firstOrNull() // TODO Java 9 has better support for this val nodeId = "$hostName:$pid" - val leaderElector = ZkClient(zkConf, "/bridge/ha", nodeId, leaderPriority) + val leaderElector = ZkClient(zkConf, conf.haConfig!!.haTopic, nodeId, leaderPriority) haElector = leaderElector val listener = object : CordaLeaderListener { override fun notLeader() { diff --git a/bridge/src/test/resources/net/corda/bridge/hawithfloat/bridge/bridge.conf b/bridge/src/test/resources/net/corda/bridge/hawithfloat/bridge/bridge.conf index ff6ca13aca..8c11372741 100644 --- a/bridge/src/test/resources/net/corda/bridge/hawithfloat/bridge/bridge.conf +++ b/bridge/src/test/resources/net/corda/bridge/hawithfloat/bridge/bridge.conf @@ -18,4 +18,6 @@ bridgeInnerConfig : { networkParametersPath = network-parameters haConfig : { haConnectionString = "zk://localhost:11105" + haPriority = 20 + haTopic = "/custom/bridge/ha" } \ No newline at end of file