From d073f53d98e75602ef6e70c08b56a8159f3f4972 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Wed, 4 Dec 2024 11:35:04 -0500 Subject: [PATCH] Addressing comments from Robbie trying to equalize the methods --- .../activemq/artemis/core/server/impl/QueueImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 481876bf11a..637483dd3cd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -2154,7 +2154,11 @@ private void expire(final Transaction tx, final MessageReference ref, final Serv Bindings bindingList = postOffice.lookupBindingsForAddress(expiryAddress); if (bindingList == null || bindingList.getBindings().isEmpty()) { - ActiveMQServerLogger.LOGGER.errorExpiringReferencesNoBindings(expiryAddress); + if (!printErrorExpiring) { + // print this only once + ActiveMQServerLogger.LOGGER.errorExpiringReferencesNoBindings(expiryAddress); + printErrorExpiring = true; + } acknowledge(tx, ref, AckReason.EXPIRED, null, delivering); } else { move(tx, expiryAddress, null, ref, false, AckReason.EXPIRED, consumer, null, delivering); @@ -2171,6 +2175,9 @@ private void expire(final Transaction tx, final MessageReference ref, final Serv if (server != null && server.hasBrokerMessagePlugins()) { if (tx == null) { + // potentially auto-delete this queue if this expired the last message + refCountForConsumers.check(); + server.callBrokerMessagePlugins(plugin -> plugin.messageExpired(ref, settingsToUse.getExpiryAddress(), consumer)); } else { ExpiryLogger expiryLogger = (ExpiryLogger) tx.getProperty(TransactionPropertyIndexes.EXPIRY_LOGGER);