I ran your reproducer on a default instance of ActiveMQ Artemis 2.33.0. At
first nothing happened so I added this to broker.xml:

  <address name="MyQueue">
     <anycast>
        <queue name="MyQueue" />
     </anycast>
  </address>

I also modified Program.cs to use an expiration time of 10000 ms rather
than 60000 ms. Then I ran it again for 60 seconds at 100 msgs/sec and I saw
the behavior you're describing. I ran "artemis queue stat" to see what
might be happening and I saw that the "missing" messages were, in fact, in
the ExpiryQueue. The consumer had just closed before it could consume them
because the expiry scanner hadn't moved them from MyQueue to ExpiryQueue
yet. Then I added this to broker.xml:

  <message-expiry-scan-period>2000</message-expiry-scan-period>

I ran the reproducer again with the same inputs as before and this time all
the messages were consumed.

I believe you're seeing the expected behavior based on how the expiry
scanner works. The expiry scanner runs every so often based on the
message-expiry-scan-period. When it runs it _won't_ scan the entire queue
as that could potentially take a long time and block scanning of other
queues. Instead it will scan the first 1,000 messages, and if there are
still more messages to be scanned it will immediately schedule another run
of the scanner which will pick up where the previous one left off. Then it
will deal with any expired messages it found in the 1,000 it scanned. In
this way the scanner will kind of nibble at the queue until all the
messages are scanned and all the expiries are dealt with. In short,
messages aren't expired all at once. With a large volume of messages it
will take some time. However, at no point should messages be lost. This is
the exact behavior I see in your reproducer.


Justin

On Mon, Apr 1, 2024 at 2:01 AM rusu ionut <ionut_rusu_2...@yahoo.ro.invalid>
wrote:

> Hello Justin,Did you have time to look into my issue? Do you have any
> update?
> Let me know if you find anything.
> Best regards,Ionut

Reply via email to