(2.12) [ADD] no responders return the original subject#5250
(2.12) [ADD] no responders return the original subject#5250neilalexander merged 1 commit intonats-io:mainfrom
Conversation
| t.Fatalf("Did not get a match for %q", l) | ||
| } | ||
| checkPayload(cr, []byte("NATS/1.0 503\r\n\r\n"), t) | ||
| checkPayload(cr, []byte("NATS/1.0 503\r\nNats-Subject: foo\r\n\r\n\r\n"), t) |
There was a problem hiding this comment.
I'm also checking that the body is empty.
| if sub := c.subForReply(c.pa.reply); sub != nil { | ||
| proto := fmt.Sprintf("HMSG %s %s 16 16\r\nNATS/1.0 503\r\n\r\n\r\n", c.pa.reply, sub.sid) | ||
| hdrLen := 32 /* header without the subject */ + len(c.pa.subject) | ||
| proto := fmt.Sprintf("HMSG %s %s %d %d\r\nNATS/1.0 503\r\nNats-Subject: %s\r\n\r\n\r\n", c.pa.reply, sub.sid, hdrLen, hdrLen, c.pa.subject) |
There was a problem hiding this comment.
I picked Nats-Subject as the header name because it is used elsewhere.
There was a problem hiding this comment.
In that case it means the original subject the current message was published as - not sure we want to use that.
There was a problem hiding this comment.
Also the only way you would get this is if you are responding and adding a reply subject - which means that when the server answers with no responders, you know what the reply subject that you published a response to is.
There was a problem hiding this comment.
Why I need the feature:
- Service A: pub reply to MyService.Endpoint with a _INBOX.
- Service B: sub to MyService.Endpoint and publish multiple times (grpc server stream) to the client _INBOX.hash with a reply option to MyService.Endpoint.
- The server tracks each inbox in a hashmap and deletes it when it receives a 503.
To resolve the issue, I'm doing something similar but my service subscribe to MyService.> and setting the reply as: MyService.Endpoint., I also could have two subscriptions, one for MyService.Endpoint and another for MyService.Endpoint.>
There was a problem hiding this comment.
Hi, @aricart. Can we review and consider this change?
|
@ripienaar Seems reasonable for me for a 2.12 change, WDYT? |
|
Yeah I thinking does make sense |
|
at some point I remember Matthias had said there was a mechanism to figure out if there was interest on a subject, is this still true or was this retracted? |
|
Hey @ramonberrutti, would you mind rebasing on top of latest |
92e2b7d to
abebcc4
Compare
Signed-off-by: Ramon Berrutti <ramonberrutti@gmail.com>
abebcc4 to
362769a
Compare
Sorry for the delay, done. Added the Signed-off too. |
Using Request-Reply is very useful.
When using Request with multiple replays, it is difficult to know when the requester loses interest in the replays.
Today, Nats returns an error 503 to the replay subject without any extra information.
Signed-off-by: Ramon Berrutti ramonberrutti@gmail.com