[
https://issues.apache.org/jira/browse/ARTEMIS-5142?focusedWorklogId=947648&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-947648
]
ASF GitHub Bot logged work on ARTEMIS-5142:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 10/Dec/24 19:29
Start Date: 10/Dec/24 19:29
Worklog Time Spent: 10m
Work Description: jbertram commented on code in PR #5334:
URL: https://github.com/apache/activemq-artemis/pull/5334#discussion_r1878709166
##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java:
##########
@@ -1366,17 +1367,36 @@ private static void applyExpiryDelay(Message message,
AddressSettings settings)
message.setExpiration(System.currentTimeMillis() +
expirationOverride);
}
} else {
- long minExpiration = settings.getMinExpiryDelay();
- long maxExpiration = settings.getMaxExpiryDelay();
-
- if (maxExpiration != AddressSettings.DEFAULT_MAX_EXPIRY_DELAY &&
(message.getExpiration() == 0 || message.getExpiration() >
(System.currentTimeMillis() + maxExpiration))) {
- message.setExpiration(System.currentTimeMillis() + maxExpiration);
- } else if (minExpiration != AddressSettings.DEFAULT_MIN_EXPIRY_DELAY
&& message.getExpiration() < (System.currentTimeMillis() + minExpiration)) {
- message.setExpiration(System.currentTimeMillis() + minExpiration);
+ // if the incoming message has NO expiration then apply the max if
set and if not set then apply the min if set
+ if (message.getExpiration() == 0) {
+ if (maxExpiration != AddressSettings.DEFAULT_MAX_EXPIRY_DELAY) {
+ if (maxExpiration != 0) {
+ message.setExpiration(getExpirationToSet(maxExpiration));
+ }
+ } else if (minExpiration !=
AddressSettings.DEFAULT_MIN_EXPIRY_DELAY) {
+ if (minExpiration != 0) {
+ message.setExpiration(getExpirationToSet(minExpiration));
+ }
+ }
+ } else if (maxExpiration != AddressSettings.DEFAULT_MAX_EXPIRY_DELAY
&& message.getExpiration() >= (System.currentTimeMillis() + maxExpiration)) {
+ message.setExpiration(getExpirationToSet(maxExpiration));
+ } else if (minExpiration != AddressSettings.DEFAULT_MIN_EXPIRY_DELAY
&& (minExpiration == 0 || message.getExpiration() < (System.currentTimeMillis()
+ minExpiration))) {
+ message.setExpiration(getExpirationToSet(minExpiration));
Review Comment:
Hmmm...So maybe the current behavior of `min-expiry-delay` and
`max-expiry-delay` is actually correct in a strict semantic interpretation and
instead of making `0` behave in a special way we should just add a new
address-setting to strip the expiration from incoming messages so they never
expire categorically which is the semantic that the Jira is really aimed at.
Issue Time Tracking
-------------------
Worklog Id: (was: 947648)
Time Spent: 5.5h (was: 5h 20m)
> Setting 0 for min/max-expiry-delay not working as expected
> ----------------------------------------------------------
>
> Key: ARTEMIS-5142
> URL: https://issues.apache.org/jira/browse/ARTEMIS-5142
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Labels: pull-request-available
> Time Spent: 5.5h
> Remaining Estimate: 0h
>
> If either {{max-expiry-delay}} or {{min-expiry-delay}} is set to {{0}}
> messages are expired _immediately_ rather than not expired at all as
> expected. Therefore, there is no way to categorically prevent incoming
> messages from expiring.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact