ARTEMIS-1350 - Added close button to console for client objs
https://issues.apache.org/jira/browse/ARTEMIS-1350
This commit is contained in:
parent
a5722d96cd
commit
4ee9580e69
|
@ -772,6 +772,24 @@ public interface ActiveMQServerControl {
|
|||
@Operation(desc = "Closes all the connections for sessions with the given user name", impact = MBeanOperationInfo.INFO)
|
||||
boolean closeConnectionsForUser(@Parameter(desc = "a user name", name = "userName") String address) throws Exception;
|
||||
|
||||
/**
|
||||
* Closes the connection with the given id.
|
||||
*/
|
||||
@Operation(desc = "Closes all the connection with the id", impact = MBeanOperationInfo.INFO)
|
||||
boolean closeConnectionWithID(@Parameter(desc = "The connection ID", name = "ID") String ID) throws Exception;
|
||||
|
||||
/**
|
||||
* Closes the session with the given id.
|
||||
*/
|
||||
@Operation(desc = "Closes the session with the id", impact = MBeanOperationInfo.INFO)
|
||||
boolean closeSessionWithID(String connectionID, String ID) throws Exception;
|
||||
|
||||
/**
|
||||
* Closes the consumer with the given id.
|
||||
*/
|
||||
@Operation(desc = "Closes the consumer with the id", impact = MBeanOperationInfo.INFO)
|
||||
boolean closeConsumerWithID(String sessionID, String ID) throws Exception;
|
||||
|
||||
/**
|
||||
* Lists all the IDs of the connections connected to this server.
|
||||
*/
|
||||
|
|
|
@ -42,10 +42,29 @@
|
|||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<form class="form-inline">
|
||||
<button class="btn-danger" ng-disabled="gridOptions.selectedItems.length == 0"
|
||||
ng-click="deleteDialog = true"
|
||||
title="Close the selected Connection">
|
||||
<i class="icon-remove"></i> Close
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div hawtio-confirm-dialog="deleteDialog"
|
||||
ok-button-text="Close"
|
||||
on-ok="closeConnection()">
|
||||
<div class="dialog-body">
|
||||
<p>You are about to close the selected connection: {{gridOptions.selectedItems[0].connectionID}}
|
||||
</p>
|
||||
<p>Are you sure you want to continue.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
|
|
@ -44,9 +44,30 @@
|
|||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
<form class="form-inline">
|
||||
<button class="btn-danger" ng-disabled="gridOptions.selectedItems.length == 0"
|
||||
ng-click="deleteDialog = true"
|
||||
title="Close the selected Consumer">
|
||||
<i class="icon-remove"></i> Close
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div hawtio-confirm-dialog="deleteDialog"
|
||||
ok-button-text="Close"
|
||||
on-ok="closeConsumer()">
|
||||
<div class="dialog-body">
|
||||
<p>You are about to close the selected consumer: {{gridOptions.selectedItems[0].id}}
|
||||
</p>
|
||||
<p>Are you sure you want to continue.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
|
|
@ -43,11 +43,32 @@
|
|||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<form class="form-inline">
|
||||
<button class="btn-danger" ng-show="gridOptions.selectedItems.length == 0"
|
||||
ng-click="deleteDialog = true"
|
||||
title="Close the selected Session">
|
||||
<i class="icon-remove"></i> Close
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div hawtio-confirm-dialog="deleteDialog"
|
||||
ok-button-text="Close"
|
||||
on-ok="closeSession()">
|
||||
<div class="dialog-body">
|
||||
<p>You are about to close the selected session: {{gridOptions.selectedItems[0].id}}
|
||||
</p>
|
||||
<p>Are you sure you want to continue.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="gridStyle" ng-grid="gridOptions" ui-grid-resize-columns></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -108,7 +108,22 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
artemisConnection.connection = connection.entity;
|
||||
$location.path("artemis/sessions");
|
||||
};
|
||||
|
||||
$scope.closeConnection = function () {
|
||||
var connectionID = $scope.gridOptions.selectedItems[0].connectionID
|
||||
ARTEMIS.log.info("closing connection: " + connectionID);
|
||||
if (workspace.selection) {
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
jolokia.request({ type: 'exec',
|
||||
mbean: mbean,
|
||||
operation: 'closeConnectionWithID(java.lang.String)',
|
||||
arguments: [connectionID] },
|
||||
onSuccess($scope.loadTable(), { error: function (response) {
|
||||
Core.defaultJolokiaErrorHandler("Could not close connection: " + response);
|
||||
}}));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
|
@ -128,7 +143,6 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
directions: ["asc"]
|
||||
};
|
||||
var refreshed = false;
|
||||
|
||||
$scope.gridOptions = {
|
||||
selectedItems: [],
|
||||
data: 'objects',
|
||||
|
@ -177,6 +191,7 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
$scope.gridOptions.selectedItems.length = 0;
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
|
|
|
@ -134,6 +134,23 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
|
||||
artemisSession.session = null;
|
||||
|
||||
$scope.closeConsumer = function () {
|
||||
var consumerID = $scope.gridOptions.selectedItems[0].id;
|
||||
var sessionID = $scope.gridOptions.selectedItems[0].session;
|
||||
ARTEMIS.log.info("closing session: " + sessionID);
|
||||
if (workspace.selection) {
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
jolokia.request({ type: 'exec',
|
||||
mbean: mbean,
|
||||
operation: 'closeConsumerWithID(java.lang.String, java.lang.String)',
|
||||
arguments: [sessionID, consumerID] },
|
||||
onSuccess($scope.loadTable(), { error: function (response) {
|
||||
Core.defaultJolokiaErrorHandler("Could not close consumer: " + response);
|
||||
}}));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
|
@ -202,6 +219,7 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
$scope.gridOptions.selectedItems.length = 0;
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
|
|
|
@ -127,7 +127,23 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
artemisSession.connection = null;
|
||||
artemisConsumer.consumer = null;
|
||||
artemisProducer.producer = null;
|
||||
|
||||
$scope.closeSession = function () {
|
||||
var sessionID = $scope.gridOptions.selectedItems[0].id;
|
||||
var connectionID = $scope.gridOptions.selectedItems[0].connectionID;
|
||||
ARTEMIS.log.info("closing session: " + sessionID);
|
||||
if (workspace.selection) {
|
||||
var mbean = getBrokerMBean(jolokia);
|
||||
if (mbean) {
|
||||
jolokia.request({ type: 'exec',
|
||||
mbean: mbean,
|
||||
operation: 'closeSessionWithID(java.lang.String, java.lang.String)',
|
||||
arguments: [connectionID, sessionID] },
|
||||
onSuccess($scope.loadTable(), { error: function (response) {
|
||||
Core.defaultJolokiaErrorHandler("Could not close session: " + response);
|
||||
}}));
|
||||
}
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Below here is utility.
|
||||
*
|
||||
|
@ -196,6 +212,7 @@ var ARTEMIS = (function(ARTEMIS) {
|
|||
Core.notification("error", "Could not retrieve " + objectType + " list from Artemis.");
|
||||
}
|
||||
function populateTable(response) {
|
||||
$scope.gridOptions.selectedItems.length = 0;
|
||||
var data = JSON.parse(response.value);
|
||||
$scope.objects = [];
|
||||
angular.forEach(data["data"], function (value, idx) {
|
||||
|
|
|
@ -1533,6 +1533,70 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
|
|||
return closed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeConnectionWithID(final String ID) {
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
try {
|
||||
for (RemotingConnection connection : remotingService.getConnections()) {
|
||||
if (connection.getID().toString().equals(ID)) {
|
||||
remotingService.removeConnection(connection.getID());
|
||||
connection.fail(ActiveMQMessageBundle.BUNDLE.connectionWithIDClosedByManagement(ID));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeSessionWithID(final String connectionID, final String ID) throws Exception {
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
try {
|
||||
List<ServerSession> sessions = server.getSessions(connectionID);
|
||||
for (ServerSession session : sessions) {
|
||||
if (session.getName().equals(ID.toString())) {
|
||||
session.close(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeConsumerWithID(final String sessionID, final String ID) throws Exception {
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
try {
|
||||
Set<ServerSession> sessions = server.getSessions();
|
||||
for (ServerSession session : sessions) {
|
||||
if (session.getName().equals(sessionID.toString())) {
|
||||
Set<ServerConsumer> serverConsumers = session.getServerConsumers();
|
||||
for (ServerConsumer serverConsumer : serverConsumers) {
|
||||
if (serverConsumer.sequentialID() == Long.valueOf(ID)) {
|
||||
serverConsumer.close(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] listConnectionIDs() {
|
||||
checkStarted();
|
||||
|
|
|
@ -386,6 +386,9 @@ public interface ActiveMQMessageBundle {
|
|||
@Message(id = 119119, value = "Disk Capacity is Low, cannot produce more messages.")
|
||||
ActiveMQIOErrorException diskBeyondLimit();
|
||||
|
||||
@Message(id = 119120, value = "connection with ID {0} closed by management", format = Message.Format.MESSAGE_FORMAT)
|
||||
ActiveMQInternalErrorException connectionWithIDClosedByManagement(String ID);
|
||||
|
||||
@Message(id = 119200, value = "Maximum Consumer Limit Reached on Queue:(address={0},queue={1})", format = Message.Format.MESSAGE_FORMAT)
|
||||
ActiveMQQueueMaxConsumerLimitReached maxConsumerLimitReachedForQueue(SimpleString address, SimpleString queueName);
|
||||
|
||||
|
|
|
@ -97,6 +97,21 @@ public class ActiveMQServerControlUsingCoreTest extends ActiveMQServerControlTes
|
|||
return (Boolean) proxy.invokeOperation("closeConnectionsForUser", userName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeConnectionWithID(String ID) throws Exception {
|
||||
return (Boolean) proxy.invokeOperation("closeConnectionWithID", ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeSessionWithID(String connectionID, String ID) throws Exception {
|
||||
return (Boolean) proxy.invokeOperation("closeSessionWithID", connectionID, ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean closeConsumerWithID(String sessionID, String ID) throws Exception {
|
||||
return (Boolean) proxy.invokeOperation("closeConsumerWithID", sessionID, ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean commitPreparedTransaction(final String transactionAsBase64) throws Exception {
|
||||
return (Boolean) proxy.invokeOperation("commitPreparedTransaction", transactionAsBase64);
|
||||
|
|
Loading…
Reference in New Issue