diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java index 0a2a1bd907..0223f9ac8b 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/connect/AMQPBrokerConnection.java @@ -509,7 +509,7 @@ public class AMQPBrokerConnection implements ClientConnectionLifeCycleListener, } try { - server.registerQueueOnManagement(mirrorControlQueue, true); + server.registerQueueOnManagement(mirrorControlQueue); } catch (Throwable ignored) { logger.debug(ignored.getMessage(), ignored); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java index 111aefc64d..9066441a77 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/view/predicate/QueueFilterPredicate.java @@ -92,6 +92,8 @@ public class QueueFilterPredicate extends ActiveMQFilterPredicate return matches(queue.getScheduledCount()); case USER: return matches(queue.getUser()); + case INTERNAL_QUEUE: + return matches(queue.isInternalQueue()); default: return true; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java index 1b04db29d3..e46e3fdafa 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java @@ -989,7 +989,7 @@ public interface ActiveMQServer extends ServiceComponent { */ void autoRemoveAddressInfo(SimpleString address, SecurityAuth auth) throws Exception; - void registerQueueOnManagement(Queue queue, boolean registerInternal) throws Exception; + void registerQueueOnManagement(Queue queue) throws Exception; /** * Remove an {@code AddressInfo} from the broker. diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index a24f5d8fae..bd4eee1e96 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -4000,8 +4000,8 @@ public class ActiveMQServerImpl implements ActiveMQServer { /** Register a queue on the management registry */ @Override - public void registerQueueOnManagement(Queue queue, boolean registerInternal) throws Exception { - managementService.registerQueue(queue, queue.getAddress(), storageManager, registerInternal); + public void registerQueueOnManagement(Queue queue) throws Exception { + managementService.registerQueue(queue, queue.getAddress(), storageManager); } @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java index 4fb88c1858..3e543b5b25 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java @@ -101,8 +101,6 @@ public interface ManagementService extends NotificationService, ActiveMQComponen void registerQueue(Queue queue, SimpleString address, StorageManager storageManager) throws Exception; - void registerQueue(Queue queue, SimpleString address, StorageManager storageManager, boolean forceInternal) throws Exception; - void unregisterQueue(SimpleString name, SimpleString address, RoutingType routingType) throws Exception; void registerAcceptor(Acceptor acceptor, TransportConfiguration configuration) throws Exception; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index 60d7a785cc..74f249ba17 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -298,18 +298,6 @@ public class ManagementServiceImpl implements ManagementService { public synchronized void registerQueue(final Queue queue, final AddressInfo addressInfo, final StorageManager storageManager) throws Exception { - registerQueue(queue, addressInfo, storageManager, false); - } - - private synchronized void registerQueue(final Queue queue, - final AddressInfo addressInfo, - final StorageManager storageManager, - boolean forceInternal) throws Exception { - - if (!forceInternal && (addressInfo.isInternal() || queue.isInternalQueue())) { - logger.debug("won't register internal queue: {}", queue); - return; - } QueueControlImpl queueControl = new QueueControlImpl(queue, addressInfo.getName().toString(), messagingServer, storageManager, securityStore, addressSettingsRepository); if (messageCounterManager != null) { @@ -332,14 +320,6 @@ public class ManagementServiceImpl implements ManagementService { registerQueue(queue, new AddressInfo(address), storageManager); } - @Override - public synchronized void registerQueue(final Queue queue, - final SimpleString address, - final StorageManager storageManager, - final boolean forceInternal) throws Exception { - registerQueue(queue, new AddressInfo(address), storageManager, forceInternal); - } - @Override public synchronized void unregisterQueue(final SimpleString name, final SimpleString address, RoutingType routingType) throws Exception { ObjectName objectName = objectNameBuilder.getQueueObjectName(address, name, routingType); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java index 15483a69ee..e844637536 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java @@ -269,11 +269,6 @@ public class ClusteredResetMockTest extends ServerTestBase { } - @Override - public void registerQueue(Queue queue, SimpleString address, StorageManager storageManager, boolean forceInternal) throws Exception { - - } - @Override public void unregisterQueue(SimpleString name, SimpleString address, RoutingType routingType) throws Exception { diff --git a/tests/compatibility-tests/src/main/resources/metrics/queueMetrics.groovy b/tests/compatibility-tests/src/main/resources/metrics/queueMetrics.groovy index 9ac89856b8..b8e105d0df 100644 --- a/tests/compatibility-tests/src/main/resources/metrics/queueMetrics.groovy +++ b/tests/compatibility-tests/src/main/resources/metrics/queueMetrics.groovy @@ -30,6 +30,10 @@ import org.apache.activemq.artemis.api.core.management.QueueControl; Object[] queueControls = server.getJMSServerManager().getActiveMQServer().getManagementService().getResources(QueueControl.class); for (Object o : queueControls) { QueueControl c = (QueueControl) o; + if (c.isInternalQueue()) { + continue; + } + GroovyRun.assertTrue(c.getPersistentSize() > 0); GroovyRun.assertTrue(c.getDurablePersistentSize() > 0); GroovyRun.assertEquals(33l, c.getMessageCount()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index a30cc03a32..405b9a2ab5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -3479,7 +3479,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { Assert.assertTrue(array.getJsonObject(1).getString("name").contains("my_queue")); //test with an empty filter - filterString = createJsonFilter("", "", ""); + filterString = createJsonFilter("internalQueue", "NOT_CONTAINS", "true"); queuesAsJsonString = serverControl.listQueues(filterString, 1, 50); @@ -3727,8 +3727,8 @@ public class ActiveMQServerControlTest extends ManagementTestBase { queuesAsJsonObject = JsonUtil.readJsonObject(queuesAsJsonString); array = (JsonArray) queuesAsJsonObject.get("data"); - Assert.assertEquals("number of queues returned from LESS_THAN query", 1, array.size()); - Assert.assertEquals("correct queue returned from query", queueName4.toString(), array.getJsonObject(0).getString("name")); + Assert.assertEquals("number of queues returned from LESS_THAN query", 2, array.size()); + Assert.assertEquals("correct queue returned from query", queueName4.toString(), array.getJsonObject(1).getString("name")); //test with GREATER_THAN returns 2 queue filterString = createJsonFilter("CONSUMER_COUNT", "GREATER_THAN", "2"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java index d4dc3ed99a..caee489cd9 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/QueueConfigPersistenceTest.java @@ -69,7 +69,7 @@ public class QueueConfigPersistenceTest extends ActiveMQTestBase { server.start(); Queue queue = server.locateQueue(getName()); Assert.assertTrue(queue.isInternalQueue()); - Assert.assertNull(server.getManagementService().getResource(ResourceNames.QUEUE + getName())); + Assert.assertNotNull(server.getManagementService().getResource(ResourceNames.QUEUE + getName())); server.stop(); }