MCPcopy
hub / github.com/nats-io/nats.go / newFetchInbox

Function newFetchInbox

js.go:3199–3208  ·  view source on GitHub ↗

newFetchInbox returns subject used as reply subject when sending pull requests as well as request ID. For non-wildcard subject, request ID is empty and passed subject is not transformed

(subj string)

Source from the content-addressed store, hash-verified

3197// as well as request ID. For non-wildcard subject, request ID is empty and
3198// passed subject is not transformed
3199func newFetchInbox(subj string) (string, string) {
3200 if !strings.HasSuffix(subj, ".*") {
3201 return subj, ""
3202 }
3203 reqID := nuid.Next()
3204 var sb strings.Builder
3205 sb.WriteString(subj[:len(subj)-1])
3206 sb.WriteString(reqID)
3207 return sb.String(), reqID
3208}
3209
3210func subjectMatchesReqID(subject, reqID string) bool {
3211 subjectParts := strings.Split(subject, ".")

Callers 2

FetchMethod · 0.85
FetchBatchMethod · 0.85

Calls 2

NextMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected