diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/brokerDiagram.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/brokerDiagram.js index 3faa0939ac..180c22fde8 100644 --- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/brokerDiagram.js +++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/brokerDiagram.js @@ -309,8 +309,10 @@ var ARTEMIS = (function(ARTEMIS) { var properties = details['attributes']; ARTEMIS.log.info("Got broker: " + objectName + " on container: " + containerId + " properties: " + angular.toJson(properties, true)); if (properties) { - var master = true; var brokerId = properties["broker"] || "unknown"; + var brokerName = artemisJmxDomain + ":broker=" + brokerId; + var backupRes = ARTEMISService.artemisConsole.isBackup(jolokia, brokerName); + var isBackup = backupRes.value; var nodeId = val["NodeID"]; var theBroker = { brokerId: brokerId, @@ -318,7 +320,7 @@ var ARTEMIS = (function(ARTEMIS) { }; brokers.push(theBroker); if ($scope.viewSettings.broker) { - var broker = getOrAddBroker(master, brokerId, nodeId, containerId, container, properties); + var broker = getOrAddBroker(!isBackup, brokerId, nodeId, containerId, container, properties); } } } @@ -461,10 +463,18 @@ var ARTEMIS = (function(ARTEMIS) { } } else { - var backup = remoteBroker.backup; - if (backup) { - getOrAddBroker(false, "\"" + remoteBroker.backup + "\"", remoteBroker.nodeID, "remote", null, properties); - addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.backup + "\"", "network"); + var newBackReq = ARTEMISService.artemisConsole.isBackup(jolokia, mBean); + var newBackup = newBackReq.value; + if (!newBackup) { + if (remoteBroker.backup) { + getOrAddBroker(false, "\"" + remoteBroker.backup + "\"", remoteBroker.nodeID, "remote", null, properties); + addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.backup + "\"", "network"); + } + } + else { + //I am backup + getOrAddBroker(true, "\"" + remoteBroker.live + "\"", remoteBroker.nodeID, "remote", null, properties); + addLinkIds("broker:" + broker.brokerId, "broker:" + "\"" + remoteBroker.live + "\"", "network"); } } } diff --git a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/lib/artemis-console.js b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/lib/artemis-console.js index 197bfae4ed..2b0e9f8561 100644 --- a/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/lib/artemis-console.js +++ b/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/lib/artemis-console.js @@ -75,6 +75,11 @@ function ArtemisConsole() { //simple return unescape(name); does not work for this :( return name.replace(/\\\\/g, "\\").replace(/\\\*/g, "*").replace(/\\\?/g, "?"); }; + + this.isBackup = function (jolokia, mBean) { + var req1 = { type: "read", mbean: mBean, attribute: "Backup"}; + return jolokia.request(req1, {method: "get"}); + }; } function getServerAttributes() {