[
https://issues.apache.org/jira/browse/AMQ-9829?focusedWorklogId=1001045&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001045
]
ASF GitHub Bot logged work on AMQ-9829:
---------------------------------------
Author: ASF GitHub Bot
Created on: 20/Jan/26 17:42
Start Date: 20/Jan/26 17:42
Worklog Time Spent: 10m
Work Description: jeanouii commented on code in PR #1616:
URL: https://github.com/apache/activemq/pull/1616#discussion_r2709419792
##########
activemq-client/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java:
##########
@@ -771,6 +778,9 @@ void clearMessagesInProgress() {
// ensure unconsumed are rolledback up front as they may
get redelivered to another consumer
List<MessageDispatch> list =
unconsumedMessages.removeAll();
if (!this.info.isBrowser()) {
+ if (session.isTransacted()) {
+
capturePrefetchedMessagesForDuplicateSuppression(list);
Review Comment:
@cshannon you are totally correct. There is no need to iterate twice. Good
catch!
Your proposal works fully.
We could probably even simply the method like this
```
private void capturePrefetchedMessagesForDuplicateSuppression(final
MessageDispatch pending) {
if (pending.getMessage() == null) return; // nothing to do
if (previouslyDeliveredMessages == null) {
previouslyDeliveredMessages = new
PreviouslyDeliveredMap<>(session.getTransactionContext().getTransactionId());
}
previouslyDeliveredMessages.put(pending.getMessage().getMessageId(), new
PreviouslyDelivered(pending, false, true));
LOG.trace("{} tracking existing transacted {} prefetched ({})",
getConsumerId(), previouslyDeliveredMessages.transactionId, pending);
}
```
Issue Time Tracking
-------------------
Worklog Id: (was: 1001045)
Time Spent: 1h 40m (was: 1.5h)
> Track prefetched messages for duplicate suppression during failover
> -------------------------------------------------------------------
>
> Key: AMQ-9829
> URL: https://issues.apache.org/jira/browse/AMQ-9829
> Project: ActiveMQ
> Issue Type: Bug
> Reporter: Jean-Louis Monteiro
> Priority: Major
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> Discovered with {{FailoverDurableSubTransactionTest}} flacky test
> During failover, messages were wrongly detected as being duplicated and sent
> to DLQ.
--
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