Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#281 - first addition of activemq durable subscription management
- Loading branch information
Showing
3 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
hawtio-web/src/main/webapp/app/activemq/html/durableSubscribers.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<form class="form-horizontal" ng-controller="ActiveMQ.DurableSubscriberController"> | ||
<div class="row-fluid"> | ||
<div class="gridStyle" ng-grid="gridOptions"></div> | ||
</div> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
hawtio-web/src/main/webapp/app/activemq/js/durableSubscriber.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
module ActiveMQ { | ||
export function DurableSubscriberController($scope, workspace:Workspace, jolokia) { | ||
|
||
$scope.refresh = loadTable; | ||
|
||
$scope.durableSubscribers = []; | ||
|
||
$scope.tempData = []; | ||
|
||
$scope.gridOptions = { | ||
selectedItems: [], | ||
data: 'durableSubscribers', | ||
displayFooter: false, | ||
showFilter: false, | ||
showColumnMenu: true, | ||
enableColumnResize: true, | ||
enableColumnReordering: true, | ||
filterOptions: { | ||
filterText: '' | ||
}, | ||
selectWithCheckboxOnly: true, | ||
showSelectionCheckbox: true, | ||
maintainColumnRatios: false, | ||
columnDefs: [ | ||
{ | ||
field: 'clientId', | ||
displayName: 'Client ID', | ||
width: '45%' | ||
}, | ||
{ | ||
field: 'consumerId', | ||
displayName: 'Consumer ID', | ||
width: '45%' | ||
}, | ||
{ | ||
field: 'status', | ||
displayName: 'Status', | ||
width: '10%' | ||
} | ||
] | ||
}; | ||
|
||
$scope.$watch('workspace.selection', function () { | ||
if (workspace.moveIfViewInvalid()) return; | ||
|
||
// lets defer execution as we may not have the selection just yet | ||
setTimeout(loadTable, 50); | ||
}); | ||
|
||
function loadTable() { | ||
var mbean = getBrokerMBean(jolokia); | ||
if (mbean) { | ||
$scope.durableSubscribers = [] | ||
jolokia.request({type: "read", mbean: mbean, attribute: ["DurableTopicSubscribers"]}, onSuccess( (response) => populateTable(response, "DurableTopicSubscribers", "Active"))); | ||
jolokia.request({type: "read", mbean: mbean, attribute: ["InactiveDurableTopicSubscribers"]}, onSuccess( (response) => populateTable(response, "InactiveDurableTopicSubscribers", "Offline"))); | ||
} | ||
} | ||
|
||
function populateTable(response, attr, status) { | ||
var data = response.value; | ||
$scope.durableSubscribers.push.apply($scope.durableSubscribers, data[attr].map(o => { | ||
var objectName = o["objectName"]; | ||
var entries = Core.objectNameProperties(objectName); | ||
entries["_id"] = objectName; | ||
entries["status"] = status; | ||
return entries; | ||
})); | ||
|
||
Core.$apply($scope); | ||
} | ||
|
||
function getBrokerMBean(jolokia) { | ||
var mbean = null; | ||
var selection = workspace.selection; | ||
if (selection && isBroker(workspace) && selection.objectName) { | ||
return selection.objectName; | ||
} | ||
var folderNames = selection.folderNames; | ||
//if (selection && jolokia && folderNames && folderNames.length > 1) { | ||
var parent = selection ? selection.parent : null; | ||
if (selection && parent && jolokia && folderNames && folderNames.length > 1) { | ||
mbean = parent.objectName; | ||
|
||
// we might be a destination, so lets try one more parent | ||
if (!mbean && parent) { | ||
mbean = parent.parent.objectName; | ||
} | ||
if (!mbean) { | ||
mbean = "" + folderNames[0] + ":BrokerName=" + folderNames[1] + ",Type=Broker"; | ||
} | ||
} | ||
return mbean; | ||
} | ||
|
||
} | ||
} |