While not as pressing it would still be worth upgrading to see if the
problem persists on the latest version. There's been some work in this area
in the last few releases.


Justin

On Wed, Aug 2, 2023 at 11:05 AM Modanese, Riccardo
<riccardo.modan...@eurotech.com.invalid> wrote:

> Sorry my fault, the version I’m using is the 2.28 not the 2.18.
>
>
> From: Justin Bertram <jbert...@apache.org>
> Date: Wednesday, 2 August 2023 at 17:54
> To: users@activemq.apache.org <users@activemq.apache.org>
> Subject: Re: Artemis 2.18 how to enable not bound address auto deletion
> Have you tried this on the latest release (i.e. 2.30.0)? The 2.18.0 release
> is fairly old at this point. A lot has changed with MQTT support since
> then. Many bugs have been fixed and support for MQTT 5 was added in 2.21.0.
>
>
> Justin
>
> On Wed, Aug 2, 2023 at 10:24 AM Modanese, Riccardo
> <riccardo.modan...@eurotech.com.invalid> wrote:
>
> > Hello,
> >     it looks like the broker is not deleting auto-created-addresses that
> > are not bound to a queue.
> > I’m using Artemis 2.18.
> > Wildcards are set as MQTT protocol specifications:
> >
> >
> >     <wildcard-addresses>
> >
> >        <routing-enabled>true</routing-enabled>
> >
> >        <delimiter>/</delimiter>
> >
> >        <any-words>#</any-words>
> >
> >       <single-word>+</single-word>
> >
> >    </wildcard-addresses>
> >
> > The address configuration is (ttl is quite low for testing purpose):
> >
> >
> >    <auto-create-queues>true</auto-create-queues>
> >
> >     <auto-create-addresses>true</auto-create-addresses>
> >
> >     <auto-create-jms-queues>true</auto-create-jms-queues>
> >
> >     <auto-create-jms-topics>true</auto-create-jms-topics>
> >
> >    <auto-delete-queues>true</auto-delete-queues>
> >
> >    <auto-delete-created-queues>true</auto-delete-created-queues>
> >
> >     <auto-delete-queues-delay>15000</auto-delete-queues-delay>
> >
> >
>  <auto-delete-queues-message-count>0</auto-delete-queues-message-count>
> >
> >     <auto-delete-addresses>true</auto-delete-addresses>
> >
> >     <auto-delete-addresses-delay>15000</auto-delete-addresses-delay>
> >
> > I used for my tests MQTT clients and, for example, if there is a
> > subscription like topic1/# and a client publishes to topic1/topic2/topic3
> > the address and the queue topic1 are deleted after client unsubscribe and
> > disconnect but not the topic1/topic2/topic3 address.
> >
> > To fix this problem I tried to delete “manually” the addresses (using a
> > specific plugin, see the code below), but under load (several messages
> per
> > second/different topics/connected clients) it looks like there is some
> > message lost.
> > Indeed, MQTT clients published messages count is higher than the messages
> > received count (I have a ServerPlugin that intercepts the beforeSend
> method
> > to count the received messages)
> >
> >
> >     private void cleanAddress(ActiveMQServer server) {
> >
> >         long currentTime = System.currentTimeMillis();
> >
> >         server.getPostOffice().getAddresses().forEach(address -> {
> >
> >             AddressInfo addressInfo = server.getAddressInfo(address);
> >
> >             String addressStr = addressInfo.getName().toString();
> >
> >             logger.debug("Evaluating address: {}",
> addressInfo.getName());
> >
> >             try {
> >
> >                 if
> > (addressInfo.getUnRoutedMessageCount()<=unroutedMessagesToDeleteAddress
> &&
> >
> >                         !server.getPostOffice().isAddressBound(address)
> &&
> >
> >                         isExpired(addressStr, currentTime)) {
> >
> >                     server.removeAddressInfo(address, null);
> >
> >                     logger.debug("Deleted address: {}", addressStr);
> >
> >                 }
> >
> >             } catch (Exception e) {
> >
> >                 logger.warn("Error deleting address {}", addressStr, e);
> >
> >             }
> >
> >         });
> >
> >         //is needed??????
> >
> >         server.clearAddressCache();
> >
> >     }
> >
> >
> >
> >     private boolean isExpired(String address, long currentTime) {
> >
> >         ...
> >
> >     }
> >
> > Can someone suggest me the right way to delete addresses (is there a way
> > to lock the address table or synchronize the deletion process) to avoid
> > losing messages?
> >
> > Thank you in advance for your feedback!
> >
> > Riccardo
> >
> >
> >
>

Reply via email to