You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by mi...@apache.org on 2018/11/09 14:43:23 UTC

[2/2] activemq-artemis git commit: ARTEMIS-1825 Live-backup topology not correctly displayed on console

ARTEMIS-1825 Live-backup topology not correctly displayed on console


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ae320c14
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ae320c14
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ae320c14

Branch: refs/heads/master
Commit: ae320c14a5db988f410242e44b9d6e5438c7914c
Parents: bd17777
Author: Howard Gao <ho...@gmail.com>
Authored: Thu Apr 26 22:31:46 2018 +0800
Committer: Michael Andre Pearce <mi...@me.com>
Committed: Fri Nov 9 14:43:34 2018 +0000

----------------------------------------------------------------------
 .../src/main/webapp/plugin/js/brokerDiagram.js  | 22 ++++++++++++++------
 .../main/webapp/plugin/lib/artemis-console.js   |  5 +++++
 2 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ae320c14/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/js/brokerDiagram.js
----------------------------------------------------------------------
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 3faa093..180c22f 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");
                               }
                            }
                         }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/ae320c14/artemis-hawtio/artemis-plugin/src/main/webapp/plugin/lib/artemis-console.js
----------------------------------------------------------------------
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 197bfae..2b0e9f8 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() {