This closes #951

This commit is contained in:
Martyn Taylor 2017-01-09 14:53:58 +00:00
commit ef4efe7d3f
5 changed files with 29 additions and 5 deletions

View File

@ -39,6 +39,12 @@ public interface AddressControl {
@Attribute(desc = "Get the delivery modes enabled on this address")
Set<RoutingType> getDeliveryModes();
/*
* Whether multicast routing is enabled for this address
* */
@Attribute(desc = "Get the delivery modes enabled on this address as JSON")
String getDeliveryModesAsJSON() throws Exception;
/**
* Returns the roles (name and permissions) associated with this address.
*/

View File

@ -357,7 +357,7 @@ public interface QueueControl {
*/
@Operation(desc = "Sends a TextMessage to a password-protected destination.", impact = MBeanOperationInfo.ACTION)
String sendMessage(@Parameter(name = "headers", desc = "The headers to add to the message") Map<String, String> headers,
@Parameter(name = "headers", desc = "A type for the message") final int type,
@Parameter(name = "type", desc = "A type for the message") final int type,
@Parameter(name = "body", desc = "The body (byte[]) of the message encoded as a string using Base64") String body,
@Parameter(name = "durable", desc = "Whether the message is durable") boolean durable,
@Parameter(name = "user", desc = "The user to authenticate with") String user,
@ -448,7 +448,7 @@ public interface QueueControl {
* Resets the MessagesAdded property
*/
@Operation(desc = "Browse Messages", impact = MBeanOperationInfo.ACTION)
CompositeData[] browse(String filter) throws Exception;
CompositeData[] browse(@Parameter(name = "filter", desc = "A message filter (can be empty)") String filter) throws Exception;
/**
* Resets the MessagesAdded property

View File

@ -101,6 +101,22 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return addressInfo.getRoutingTypes();
}
@Override
public String getDeliveryModesAsJSON() throws Exception {
clearIO();
try {
JsonArrayBuilder json = JsonLoader.createArrayBuilder();
Set<RoutingType> routingTypes = getDeliveryModes();
for (RoutingType routingType : routingTypes) {
json.add(routingType.toString());
}
return json.build().toString();
} finally {
blockOnIO();
}
}
@Override
public String[] getQueueNames() throws Exception {
clearIO();

View File

@ -915,7 +915,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
return browse(null);
}
@Override
public CompositeData[] browse(String filterStr) throws Exception {
public CompositeData[] browse(String filter) throws Exception {
checkStarted();
clearIO();
@ -923,12 +923,12 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
int pageSize = addressSettingsRepository.getMatch(queue.getName().toString()).getManagementBrowsePageSize();
int currentPageSize = 0;
ArrayList<CompositeData> c = new ArrayList<>();
Filter filter = FilterImpl.createFilter(filterStr);
Filter thefilter = FilterImpl.createFilter(filter);
queue.flushExecutor();
try (LinkedListIterator<MessageReference> iterator = queue.browserIterator()) {
while (iterator.hasNext() && currentPageSize++ < pageSize) {
MessageReference ref = iterator.next();
if (filter == null || filter.match(ref.getMessage())) {
if (thefilter == null || thefilter.match(ref.getMessage())) {
c.add(OpenTypeSupport.convert(ref));
}

View File

@ -868,6 +868,8 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener {
ref.acknowledge(tx);
acks++;
if (startedTransaction) {
tx.commit();
}