[ 
https://issues.apache.org/jira/browse/ARTEMIS-5142?focusedWorklogId=947634&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-947634
 ]

ASF GitHub Bot logged work on ARTEMIS-5142:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Dec/24 18:27
            Start Date: 10/Dec/24 18:27
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #5334:
URL: https://github.com/apache/activemq-artemis/pull/5334#discussion_r1878619808


##########
artemis-server/src/test/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImplTest.java:
##########
@@ -99,6 +99,14 @@ public void testZeroMinExpiryDelayWhenExpirationSet() {
       Mockito.verify(mockMessage).setExpiration(0L);
    }
 
+   @Test
+   public void testZeroMinExpiryDelayWhenExpirationSetInFuture() {
+      Message mockMessage = Mockito.mock(Message.class);
+      
Mockito.when(mockMessage.getExpiration()).thenReturn(System.currentTimeMillis() 
+ 500_000L);
+      PostOfficeImpl.applyExpiryDelay(mockMessage, new 
AddressSettings().setMinExpiryDelay(0L));
+      Mockito.verify(mockMessage).setExpiration(0L);
+   }

Review Comment:
   Thinking about this more...I'm not sure a `min-expiry-delay` of `0` even 
makes sense. The overall goal of this change is to enable users to never expire 
incoming messages regardless of the message's existing expiration. If they want 
to do that then they should set `max-expiry-delay` to `0` and leave 
`expiry-delay` and `min-expiry-delay` unset (i.e. `-1`). 
   
   Setting `min-expiry-delay` to `0` is really just meaningless. A message will 
not realistically have an expiration below `0` and if there's no max set (as in 
this test) then anything above `0` should remain unchanged.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 947634)
    Time Spent: 5h  (was: 4h 50m)

> Setting 0 for min/max expiry-delivery 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: 5h
>  Remaining Estimate: 0h
>
> If {{max-expiry-delay}} or {{min-expiry-delay}} is set to {{0}} messages are 
> expired _immediately_ rather than not expired at all as expected.



--
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


Reply via email to