Closed gstaware closed 3 years ago
After experimentation I was able to reproduce this when a consumer didn't exist. The message returned is a no responder message, which has no payload and has the inbox as a reply subject. We'll update the API to better address this situation.
TODO: Investigate the best way to handle this. First thoughts include overriding nextMessage()
in the JetStreamSubscription to throw an illegal state exception on no-responders. Alternatively, if there's a way to peek at the message or handle this when the subscription is made that'd be better.
Hi Colin, consumer does exist on the server and payload is also not empty still we are not entering msg.isJetStream() block. Below is the code snippet and output. Kindly advise.
SubscribeOptions so = SubscribeOptions.builder() .attach("test-stream", "test-consumer") .durable("test-consumer") .pushDirect("showcase.helloworld.foo") .build();
Message Received: Headers: header_key1: header_value1 Subject: showcase.helloworld.foo Data: Hello World getReplyTo: _INBOX.94gduWXNziA6e8JQKCO4Ir
@gstaware , we're having trouble reproducing this with the latest server build (commit: 51a321e7393262768b757d5dbcedb735c0236307).
Do the tests in PR #397 accurately reflect what is going on in your environment? If not, please let us know how they differ and we'll write a test to prove that out.
@gstaware The direct api have been removed for better options and certainly many improvements. Please let me know if you still have issues, otherwise I'd like to close this issue.
In the jetstream subscriber examples, if (msg.isJetStream()) { block is never getting executed because its reply subject starts with _INBOX.> instead of $JS.> as mentioned in NatsMessage.isJetStream method. Because of this messages are not getting acked in stream. I tried with direct sub attach example. Could you please advise?
https://github.com/nats-io/nats.java/blob/271958ee23c00c9f5867931e2c652277e9efff8b/src/examples/java/io/nats/examples/NatsJsSubAttachDirect.java#L89
https://github.com/nats-io/nats.java/blob/271958ee23c00c9f5867931e2c652277e9efff8b/src/main/java/io/nats/client/impl/NatsMessage.java#L467