ARTEMIS-1579 browsing messages in hawtio console
This commit is contained in:
parent
e5251ce60b
commit
21b58bfea8
|
@ -223,6 +223,9 @@ public interface QueueControl {
|
||||||
@Operation(desc = "Returns the number of the messages in the queue matching the given filter", impact = MBeanOperationInfo.INFO)
|
@Operation(desc = "Returns the number of the messages in the queue matching the given filter", impact = MBeanOperationInfo.INFO)
|
||||||
long countMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
|
long countMessages(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
|
||||||
|
|
||||||
|
@Operation(desc = "Returns the number of the messages in the queue", impact = MBeanOperationInfo.INFO)
|
||||||
|
long countMessages() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the message corresponding to the specified message ID.
|
* Removes the message corresponding to the specified message ID.
|
||||||
*
|
*
|
||||||
|
@ -464,12 +467,13 @@ public interface QueueControl {
|
||||||
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
|
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
|
||||||
CompositeData[] browse() throws Exception;
|
CompositeData[] browse() throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the MessagesAdded property
|
|
||||||
*/
|
|
||||||
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
|
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
|
||||||
CompositeData[] browse(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
|
CompositeData[] browse(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
|
||||||
|
|
||||||
|
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
|
||||||
|
CompositeData[] browse(@Parameter(name = "page", desc = "Current page") int page,
|
||||||
|
@Parameter(name = "pageSize", desc = "Page size") int pageSize) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the MessagesAdded property
|
* Resets the MessagesAdded property
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
var ARTEMIS = (function(ARTEMIS) {
|
var ARTEMIS = (function(ARTEMIS) {
|
||||||
|
|
||||||
ARTEMIS.BrowseQueueController = function ($scope, workspace, ARTEMISService, jolokia, localStorage, artemisMessage, $location, $timeout) {
|
ARTEMIS.BrowseQueueController = function ($scope, workspace, ARTEMISService, jolokia, localStorage, artemisMessage, $location, $timeout) {
|
||||||
|
$scope.pagingOptions = {
|
||||||
|
pageSizes: [50, 100, 200],
|
||||||
|
pageSize: 100,
|
||||||
|
currentPage: 1
|
||||||
|
};
|
||||||
|
$scope.totalServerItems = 0;
|
||||||
$scope.searchText = '';
|
$scope.searchText = '';
|
||||||
$scope.allMessages = [];
|
$scope.allMessages = [];
|
||||||
$scope.messages = [];
|
$scope.messages = [];
|
||||||
|
@ -28,6 +34,10 @@ var ARTEMIS = (function(ARTEMIS) {
|
||||||
$scope.deleteDialog = false;
|
$scope.deleteDialog = false;
|
||||||
$scope.moveDialog = false;
|
$scope.moveDialog = false;
|
||||||
$scope.gridOptions = {
|
$scope.gridOptions = {
|
||||||
|
pagingOptions: $scope.pagingOptions,
|
||||||
|
enablePaging: true,
|
||||||
|
totalServerItems: 'totalServerItems',
|
||||||
|
showFooter: true,
|
||||||
selectedItems: [],
|
selectedItems: [],
|
||||||
data: 'messages',
|
data: 'messages',
|
||||||
displayFooter: false,
|
displayFooter: false,
|
||||||
|
@ -102,6 +112,14 @@ var ARTEMIS = (function(ARTEMIS) {
|
||||||
$scope.$watch('gridOptions.filterOptions.filterText', function (filterText) {
|
$scope.$watch('gridOptions.filterOptions.filterText', function (filterText) {
|
||||||
filterMessages(filterText);
|
filterMessages(filterText);
|
||||||
});
|
});
|
||||||
|
$scope.$watch('pagingOptions', function (newVal, oldVal) {
|
||||||
|
if (parseInt(newVal.currentPage) && newVal !== oldVal && newVal.currentPage !== oldVal.currentPage) {
|
||||||
|
loadTable();
|
||||||
|
}
|
||||||
|
if (parseInt(newVal.pageSize) && newVal !== oldVal && newVal.pageSize !== oldVal.pageSize) {
|
||||||
|
$scope.pagingOptions.currentPage = 1;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
$scope.openMessageDialog = function (message) {
|
$scope.openMessageDialog = function (message) {
|
||||||
ARTEMIS.selectCurrentMessage(message, "messageID", $scope);
|
ARTEMIS.selectCurrentMessage(message, "messageID", $scope);
|
||||||
if ($scope.row) {
|
if ($scope.row) {
|
||||||
|
@ -362,7 +380,8 @@ var ARTEMIS = (function(ARTEMIS) {
|
||||||
else {
|
else {
|
||||||
onDlq(false);
|
onDlq(false);
|
||||||
}
|
}
|
||||||
ARTEMISService.artemisConsole.browse(objName, jolokia, onSuccess(populateTable));
|
jolokia.request({ type: 'exec', mbean: objName, operation: 'countMessages()'}, onSuccess(function(response) {$scope.totalServerItems = response.value;}));
|
||||||
|
jolokia.request({ type: 'exec', mbean: objName, operation: 'browse(int, int)', arguments: [$scope.pagingOptions.currentPage, $scope.pagingOptions.pageSize] }, onSuccess(populateTable));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -544,6 +544,11 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
|
||||||
return now - firstMessageTimestamp.longValue();
|
return now - firstMessageTimestamp.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countMessages() throws Exception {
|
||||||
|
return countMessages(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long countMessages(final String filterStr) throws Exception {
|
public long countMessages(final String filterStr) throws Exception {
|
||||||
checkStarted();
|
checkStarted();
|
||||||
|
@ -960,6 +965,47 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompositeData[] browse(int page, int pageSize) throws Exception {
|
||||||
|
String filter = null;
|
||||||
|
checkStarted();
|
||||||
|
|
||||||
|
clearIO();
|
||||||
|
try {
|
||||||
|
long index = 0;
|
||||||
|
long start = (page - 1) * pageSize;
|
||||||
|
long end = Math.min((long)(page * pageSize), queue.getMessageCount());
|
||||||
|
|
||||||
|
ArrayList<CompositeData> c = new ArrayList<>();
|
||||||
|
Filter thefilter = FilterImpl.createFilter(filter);
|
||||||
|
queue.flushExecutor();
|
||||||
|
|
||||||
|
try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) {
|
||||||
|
try {
|
||||||
|
while (iterator.hasNext() && index < end) {
|
||||||
|
MessageReference ref = iterator.next();
|
||||||
|
if (thefilter == null || thefilter.match(ref.getMessage())) {
|
||||||
|
if (index >= start) {
|
||||||
|
c.add(OpenTypeSupport.convert(ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
} catch (NoSuchElementException ignored) {
|
||||||
|
// this could happen through paging browsing
|
||||||
|
}
|
||||||
|
|
||||||
|
CompositeData[] rc = new CompositeData[c.size()];
|
||||||
|
c.toArray(rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
} catch (ActiveMQException e) {
|
||||||
|
throw new IllegalStateException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
blockOnIO();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompositeData[] browse() throws Exception {
|
public CompositeData[] browse() throws Exception {
|
||||||
return browse(null);
|
return browse(null);
|
||||||
|
|
|
@ -56,6 +56,11 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
|
||||||
return (Long) proxy.invokeOperation(Long.class, "countMessages", filter);
|
return (Long) proxy.invokeOperation(Long.class, "countMessages", filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long countMessages() throws Exception {
|
||||||
|
return (Long) proxy.invokeOperation(Long.class, "countMessages");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean expireMessage(final long messageID) throws Exception {
|
public boolean expireMessage(final long messageID) throws Exception {
|
||||||
return (Boolean) proxy.invokeOperation("expireMessage", messageID);
|
return (Boolean) proxy.invokeOperation("expireMessage", messageID);
|
||||||
|
@ -385,6 +390,16 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
|
||||||
return compositeDatas;
|
return compositeDatas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompositeData[] browse(int page, int pageSize) throws Exception {
|
||||||
|
Map map = (Map) proxy.invokeOperation("browse", page, pageSize);
|
||||||
|
CompositeData[] compositeDatas = (CompositeData[]) map.get(CompositeData.class.getName());
|
||||||
|
if (compositeDatas == null) {
|
||||||
|
compositeDatas = new CompositeData[0];
|
||||||
|
}
|
||||||
|
return compositeDatas;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CompositeData[] browse(String filter) throws Exception {
|
public CompositeData[] browse(String filter) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue