Point of Checking of Message Expiry
The server adds the current specified time of TTL to the current time and obtains the expiry time. This is done when the message fist enters the server. The server checks for expiry when attempting to deliver it to a consumer. If expired, the message is ignored.
Since expiry is checked just before delivering the message to a consumer; if there is no active consumer, expired messages might continue to consume server resources (disk or memory space). To optimize performance and server resources, the server can be configured to check expired messages in all queues periodically. To enable this, set the value of the flag DbCleanupEnabled to true. (By default, it is set to false.) The frequency with which the server checks for expired messages is configured through the parameter CleanupInterval. (By default set to 10 minutes.)