ARTEMIS-4022 add auto-delete queue attribute to management
This commit is contained in:
parent
5cf84bffbe
commit
5343c97c7d
|
@ -2632,4 +2632,11 @@ public interface AuditLogger {
|
|||
|
||||
@LogMessage(id = 601765, value = "User {} is getting status on target resource: {}", level = LogMessage.Level.INFO)
|
||||
void getStatus(String user, Object source);
|
||||
|
||||
static void isAutoDelete(Object source) {
|
||||
BASE_LOGGER.isAutoDelete(getCaller(), source);
|
||||
}
|
||||
|
||||
@LogMessage(id = 601766, value = "User {} is getting auto-delete property on target resource: {}", level = LogMessage.Level.INFO)
|
||||
void isAutoDelete(String user, Object source);
|
||||
}
|
||||
|
|
|
@ -782,4 +782,10 @@ public interface QueueControl {
|
|||
*/
|
||||
@Operation(desc = "Immediately deliver the scheduled message with the specified message ID", impact = MBeanOperationInfo.ACTION)
|
||||
void deliverScheduledMessage(@Parameter(name = "messageID", desc = "ID of the message to deliver") long messageId) throws Exception;
|
||||
|
||||
/**
|
||||
* Returns whether this queue is available for auto deletion.
|
||||
*/
|
||||
@Attribute(desc = "whether this queue is available for auto deletion")
|
||||
boolean isAutoDelete();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,8 @@ var Artemis;
|
|||
{name: "Queue Enabled", visible: false},
|
||||
{name: "Ring Size", visible: false},
|
||||
{name: "Consumers Before Dispatch", visible: false},
|
||||
{name: "Delay Before Dispatch", visible: false}
|
||||
{name: "Delay Before Dispatch", visible: false},
|
||||
{name: "Auto Delete", visible: false}
|
||||
]
|
||||
};
|
||||
|
||||
|
@ -140,7 +141,8 @@ var Artemis;
|
|||
{id: 'deliveringCount', name: 'Delivering Count'},
|
||||
{id: 'paused', name: 'Paused'},
|
||||
{id: 'temporary', name: 'Temporary'},
|
||||
{id: 'autoCreated', name: 'Auto Created'}
|
||||
{id: 'autoCreated', name: 'Auto Created'},
|
||||
{id: 'autoDelete', name: 'Auto Delete'}
|
||||
],
|
||||
operationOptions: [
|
||||
{id: 'EQUALS', name: 'Equals'},
|
||||
|
@ -215,7 +217,8 @@ var Artemis;
|
|||
{ header: 'Enabled', itemField: 'enabled'},
|
||||
{ header: 'Ring Size', itemField: 'ringSize'},
|
||||
{ header: 'Consumers Before Dispatch', itemField: 'consumersBeforeDispatch'},
|
||||
{ header: 'Delay Before Dispatch', itemField: 'delayBeforeDispatch'}
|
||||
{ header: 'Delay Before Dispatch', itemField: 'delayBeforeDispatch'},
|
||||
{ header: 'Auto Delete', itemField: 'autoDelete'}
|
||||
];
|
||||
|
||||
ctrl.refresh = function () {
|
||||
|
|
|
@ -1994,6 +1994,22 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoDelete() {
|
||||
|
||||
if (AuditLogger.isBaseLoggingEnabled()) {
|
||||
AuditLogger.isAutoDelete(queue);
|
||||
}
|
||||
checkStarted();
|
||||
|
||||
clearIO();
|
||||
try {
|
||||
return queue.isAutoDelete();
|
||||
} finally {
|
||||
blockOnIO();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkStarted() {
|
||||
if (!server.getPostOffice().isStarted()) {
|
||||
throw new IllegalStateException("Broker is not started. Queue can not be managed yet");
|
||||
|
|
|
@ -52,7 +52,8 @@ public enum QueueField {
|
|||
ENABLED("enabled"),
|
||||
RING_SIZE("ringSize"),
|
||||
CONSUMERS_BEFORE_DISPATCH("consumersBeforeDispatch"),
|
||||
DELAY_BEFORE_DISPATCH("delayBeforeDispatch");
|
||||
DELAY_BEFORE_DISPATCH("delayBeforeDispatch"),
|
||||
AUTO_DELETE("autoDelete");
|
||||
|
||||
private static final Map<String, QueueField> lookup = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
|
|
|
@ -76,7 +76,8 @@ public class QueueView extends ActiveMQAbstractView<QueueControl> {
|
|||
.add(QueueField.ENABLED.getName(), toString(queue.isEnabled()))
|
||||
.add(QueueField.RING_SIZE.getName(), toString(queue.getRingSize()))
|
||||
.add(QueueField.CONSUMERS_BEFORE_DISPATCH.getName(), toString(queue.getConsumersBeforeDispatch()))
|
||||
.add(QueueField.DELAY_BEFORE_DISPATCH.getName(), toString(queue.getDelayBeforeDispatch()));
|
||||
.add(QueueField.DELAY_BEFORE_DISPATCH.getName(), toString(queue.getDelayBeforeDispatch()))
|
||||
.add(QueueField.AUTO_DELETE.getName(), toString(q.isAutoDelete()));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -3008,6 +3008,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
|
|||
Assert.assertEquals("groupRebalance", "false", array.getJsonObject(0).getString("groupRebalance"));
|
||||
Assert.assertEquals("groupBuckets", "-1", array.getJsonObject(0).getString("groupBuckets"));
|
||||
Assert.assertEquals("groupFirstKey", "", array.getJsonObject(0).getString("groupFirstKey"));
|
||||
Assert.assertEquals("autoDelete", "false", array.getJsonObject(0).getString("autoDelete"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -268,6 +268,35 @@ public class QueueControlTest extends ManagementTestBase {
|
|||
session.deleteQueue(queue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoDeleteAttribute() throws Exception {
|
||||
SimpleString address = RandomUtil.randomSimpleString();
|
||||
SimpleString queue = RandomUtil.randomSimpleString();
|
||||
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address));
|
||||
|
||||
QueueControl queueControl = createManagementControl(address, queue);
|
||||
Assert.assertFalse(queueControl.isAutoDelete());
|
||||
|
||||
session.deleteQueue(queue);
|
||||
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoDelete(true));
|
||||
|
||||
queueControl = createManagementControl(address, queue);
|
||||
Assert.assertTrue(queueControl.isAutoDelete());
|
||||
|
||||
session.deleteQueue(queue);
|
||||
|
||||
server.getAddressSettingsRepository().addMatch(address.toString(), new AddressSettings().setAutoDeleteQueues(true));
|
||||
|
||||
session.createQueue(new QueueConfiguration(queue).setAddress(address).setAutoCreated(true));
|
||||
|
||||
queueControl = createManagementControl(address, queue);
|
||||
Assert.assertTrue(queueControl.isAutoDelete());
|
||||
|
||||
session.deleteQueue(queue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGroupAttributes() throws Exception {
|
||||
SimpleString address = RandomUtil.randomSimpleString();
|
||||
|
|
|
@ -76,6 +76,11 @@ public class QueueControlUsingCoreTest extends QueueControlTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAutoDelete() {
|
||||
return (Boolean) proxy.retrieveAttributeValue("autoDelete");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAllGroups() {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue