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

Method Request

enc.go:131–147  ·  view source on GitHub ↗

Request will create an Inbox and perform a Request() call with the Inbox reply for the data v. A response will be decoded into the vPtr Response. Deprecated: Encoded connections are no longer supported.

(subject string, v any, vPtr any, timeout time.Duration)

Source from the content-addressed store, hash-verified

129//
130// Deprecated: Encoded connections are no longer supported.
131func (c *EncodedConn) Request(subject string, v any, vPtr any, timeout time.Duration) error {
132 b, err := c.Enc.Encode(subject, v)
133 if err != nil {
134 return err
135 }
136 m, err := c.Conn.Request(subject, b, timeout)
137 if err != nil {
138 return err
139 }
140 if reflect.TypeOf(vPtr) == emptyMsgType {
141 mPtr := vPtr.(*Msg)
142 *mPtr = *m
143 } else {
144 err = c.Enc.Decode(m.Subject, m.Data, vPtr)
145 }
146 return err
147}
148
149// Handler is a specific callback used for Subscribe. It is generalized to
150// an any, but we will discover its format and arguments at runtime

Callers 3

TesEncodedConnRequestFunction · 0.95
TestRequestGOBFunction · 0.95

Calls 2

EncodeMethod · 0.65
DecodeMethod · 0.65

Tested by 3

TesEncodedConnRequestFunction · 0.76
TestRequestGOBFunction · 0.76