Closed thomasdarimont closed 6 days ago
@thomasdarimont As far as double ack, do you mean acking and waiting for the server to respond to ensure the ack was received? If that is the case you are looking for
void ackSync(Duration timeout) throws TimeoutException, InterruptedException;
@thomasdarimont What do you expect the behavior of double ack to be? ackSync behavior waits for the server to respond for the length of the timeout. ackSync blocks until it gets a response or it times out. A response from the server indicates it has processed the ack.
for (var msg : fetched) {
// double ack feature missing here!
// msg.ackSync(Duration.ofSeconds(1));
// msg.ack();
}
@thomasdarimont I'm planning on closing this issue unless I hear back from you.
Hello @scottf sorry for the late response.
I'm trying to replicate the go/rust examples as close as possible for a talk at our local Java User Group. Since not all NATs use-cases have Java examples, I tried to add a Java example for every NATs use-case. I was a bit puzzled, because I couldn't get the application to produce the same output sequence with the Java SDK as the go / rust examples did.
I expected that there is an explicit equivalent for Message#DoubleAck as used here: https://github.com/ConnectEverything/nats-by-example/blob/main/examples/jetstream/interest-stream/go/main.go#L140
Even with msg.ackSync(Duration.ofSeconds(1));
I couldn't replicate the example output, but perhaps that.
If msg.ackSync(...)
is the best way to model msg.DoubleAck
in the other SDKs I think it would be helpful to highlight this in the documentation somewhere.
Observed behavior
The Java SDK currently lacks some functionality like "double ack" to reproduce the example.
Expected behavior
The Java SDK should offer the same functionality as the other language integrations.
Server and client version
Nats Server Version: 2.10.14 Java SDK:
Host environment
No response
Steps to reproduce
Inspect and compare the following program with https://natsbyexample.com/examples/jetstream/interest-stream/rust
Maven POM excerpt:
Serde helper class: