thyandrecardoso opened a new pull request, #2018: URL: https://github.com/apache/pekko-connectors/pull/2018
### Motivation `AmqpFlow.withConfirm` and `AmqpFlowWithContext.withConfirm` can report rejected messages as confirmed, or confirmed messages as rejected. For callers that retry on rejection, this can cause silent message loss or duplicate delivery. The ordered stage stores only whether each message is ready. When an earlier message resolves, every ready message released alongside it inherits the result of the callback that triggered the release. For example, a nack for message 2 followed by an ack for message 1 causes both messages to be reported as confirmed. ### Modification - Replace the per-message ready flag with an optional `WriteResult`. - Preserve each message’s first result, including when a later batch acknowledgement covers it. - Release consecutive messages with results from the front of the buffer, including ready messages beyond the batch tag. - Emit each message with its own result and cancel its confirmation timer once the result arrives. - Share result handling with the unordered stage and remove the faulty `isAtHead` check. - Add three regression tests covering mixed out-of-order results, batch acknowledgements, and a confirmation waiting behind a timeout. - Give callback-driven ordered tests a confirmation timeout matching test patience; retain a short timeout for the timeout regression. ### Result Ordered confirmation flows preserve publish order and report each message’s own outcome. ### Tests - All 19 mocked `AmqpFlowSpec` tests pass with `CI=true` on Scala 2.13.18 and 3.3.8, including the three new regressions. - All three regression tests fail against the original implementation. - `sbt '+amqp/mimaReportBinaryIssues' '+amqp/headerCheckAll'`: pass. - `scalafmt --test --mode diff-ref=origin/main` and `git diff --check`: pass. - The fix was also verified on v1.3.0. A RabbitMQ 3.13 Testcontainers reproducer using five persistent messages and a queue configured with `x-max-length=1` and `reject-publish` passes 3/3 runs with the patched connector. Unpatched 1.3.0 incorrectly reports the four rejected messages as confirmed. ### References None -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
