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

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

                Author: ASF GitHub Bot
            Created on: 09/May/24 03:22
            Start Date: 09/May/24 03:22
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #4929:
URL: https://github.com/apache/activemq-artemis/pull/4929#discussion_r1594918161


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java:
##########
@@ -243,10 +243,6 @@ public void handleAddMessage(Map<Long, Map<Long, 
AddMessageRecord>> queueMap) th
                MessageReference ref = postOffice.reload(record.getMessage(), 
queue, null);
 
                ref.setDeliveryCount(record.getDeliveryCount());
-
-               if (scheduledDeliveryTime != 0) {
-                  record.getMessage().setScheduledDeliveryTime(0L);

Review Comment:
   If you look a few lines up from the code I removed you'll see this:
   ```java
   if (scheduledDeliveryTime != 0) {
      record.getMessage().setScheduledDeliveryTime(scheduledDeliveryTime);
   }
   ```
   So first we set it to `scheduledDeliveryTime` and then we set it to `0`. One 
of these must be wrong. I believe the one I removed in the wrong one.
   
   There is another block still further up that does this:
   ```java
   if (scheduledDeliveryTime != 0 && scheduledDeliveryTime <= currentTime) {
      scheduledDeliveryTime = 0;
      record.getMessage().setScheduledDeliveryTime(0L);
   }
   ```
   Reloading a message _whose scheduled delivery time is already passed_ should 
not be scheduled. Is this what you were referring to?





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

    Worklog Id:     (was: 918469)
    Time Spent: 0.5h  (was: 20m)

> Property _AMQ_SCHED_DELIVERY lost from Scheduled Persistent Message after 
> broker restart
> ----------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-4768
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4768
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.19.1, 2.33.0
>            Reporter: Ajay P
>            Assignee: Justin Bertram
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Im seeing something peculiar related to messages with Scheduled Delivery on 
> artemis 2.33.0 and a few prev versions too.
> We transmit persistent messages for scheduled delivery with the property 
> _AMQ_SCHED_DELIVERY set to the time.  There is a use case for being able to 
> browse these queues for scheduled messages and remove them if they need to be 
> canceled before delivery. This works fine and when browsing the queue using 
> listScheduledMessages, all properties on said message are visible. We use 
> this to show a list of scheduled messages that will be transmitted in the 
> future.
> However, if the broker is restarted, then the message does not have that 
> _AMQ_SCHED_DELIVERY property set anymore. The broker still delivers the 
> message on the scheduled time but while browsing through the queue messages 
> that specific property is not on the message. 
>  
> Here is a link to a fork with a test case checked in.
> [https://github.com/aahrimaan/activemq-scheduled-messages-issue]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to