Skip to content

Commit 73ba7a6

Browse files
authored
Fix AckMPTest RC when delayed ack asks offset of the next message (#10831)
* Fix ack rc when delayed ack asks offset of the next message #7011 Signed-off-by: Daniel Kec <[email protected]>
1 parent dd4a496 commit 73ba7a6

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

tests/integration/jms/src/test/java/io/helidon/messaging/connectors/jms/AckMpTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.lang.annotation.Annotation;
2020
import java.time.Duration;
2121
import java.util.List;
22+
import java.util.concurrent.CompletableFuture;
23+
import java.util.concurrent.CompletionStage;
2224

2325
import io.helidon.messaging.connectors.mock.MockConnector;
2426
import io.helidon.messaging.connectors.mock.TestConnector;
@@ -83,15 +85,18 @@ public class AckMpTest extends AbstractMPTest {
8385
@Incoming("test-channel-ack-1")
8486
@Outgoing("mock-conn-channel")
8587
@Acknowledgment(Acknowledgment.Strategy.MANUAL)
86-
public Message<String> channelAck(Message<String> msg) {
88+
public CompletionStage<Message<String>> channelAck(Message<String> msg) {
8789
LOGGER.log(DEBUG, () -> String.format("Received %s", msg.getPayload()));
8890
if (msg.getPayload().startsWith("NO_ACK")) {
8991
LOGGER.log(DEBUG, () -> String.format("NOT Acked %s", msg.getPayload()));
92+
return CompletableFuture.completedStage(msg);
9093
} else {
9194
LOGGER.log(DEBUG, () -> String.format("Acked %s", msg.getPayload()));
92-
msg.ack();
95+
return msg.ack().thenApply(unused -> {
96+
LOGGER.log(DEBUG, () -> String.format("Ack of %s confirmed", msg.getPayload()));
97+
return msg;
98+
});
9399
}
94-
return msg;
95100
}
96101

97102
@Test

tests/integration/jms/src/test/resources/logging.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2020, 2023 Oracle and/or its affiliates.
2+
# Copyright (c) 2020, 2025 Oracle and/or its affiliates.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -19,6 +19,6 @@ handlers=io.helidon.logging.jul.HelidonConsoleHandler
1919
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n
2020

2121
#All log level details
22-
.level=SEVERE
23-
io.helidon.messaging.level=INFO
22+
.level=WARNING
23+
io.helidon.messaging.connectors.jms.AckMpTest.level=FINE
2424
io.helidon.microprofile.level=INFO

0 commit comments

Comments
 (0)