Closed Radagan closed 1 month ago
This works as expected. If you send to a subject that is backed by a JetStream's stream, then the jet stream module will reply to the sender (when the published message has a reply subject) with information about the stream it was stored on and the index. You should use JetStream APIs to interact with JetStream assets.
Remember that the message you are publishing using the request/reply paradigm is going to be stored in the stream, and possibly replayed/consume many times. What does it mean in the context that you are using it?
If you still want to use request/reply with a subject that is backed by a stream and do not want the JetStream module to send back an ack, you should create the stream with the "NoAck" property.
Thank you for clarifying this behavior. When using the library against a nats server with both core and jet stream backed subjects, this ack results in unexpectedly different behavior to the client code. This does not seem desirable as server configurations can be dynamic, and client code rarely is. So a configuration change on a server could break previously functioning client code.
I think some mention of this in the api docs would be helpful.
Thank you for the tip about disabling the acks. I'll try that for sure.
Observed behavior
When used with Core NATS the reply is as expected, but when the same code is used with a subject that is part of a jet stream, then an odd json string is returned.
Given a jet stream named "networking" and one request, this is the reply:
Expected behavior
I would expect the reply that was sent from the subscriber that answered the request.
Server and client version
These are unit tests, so both client and server are: Linux (Debian 12, Bookworm)
$ sudo nats-server --version nats-server: v2.9.10
$ nats --version 0.1.4
nats.c library is https://github.com/nats-io/nats.c/releases/tag/v3.8.2
Host environment
No response
Steps to reproduce
Repeat with a non-jet stream back subject.
I find that the jet stream backed subject responds with stream like status, while non-jet stream back subjects deliver the sent reply.
I have also tried using stream based methods for subscribing, but the issue remains the same.