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

Method RequestMsgWithContext

context.go:23–32  ·  view source on GitHub ↗

RequestMsgWithContext takes a context, a subject and payload in bytes and request expecting a single response.

(ctx context.Context, msg *Msg)

Source from the content-addressed store, hash-verified

21// RequestMsgWithContext takes a context, a subject and payload
22// in bytes and request expecting a single response.
23func (nc *Conn) RequestMsgWithContext(ctx context.Context, msg *Msg) (*Msg, error) {
24 if msg == nil {
25 return nil, ErrInvalidMsg
26 }
27 hdr, err := msg.headerBytes()
28 if err != nil {
29 return nil, err
30 }
31 return nc.requestWithContext(ctx, msg.Subject, hdr, msg.Data)
32}
33
34// RequestWithContext takes a context, a subject and payload
35// in bytes and request expecting a single response.

Callers 5

PublishMsgMethod · 0.80
TestRequestMsgFunction · 0.80
PublishMsgMethod · 0.80

Calls 2

requestWithContextMethod · 0.95
headerBytesMethod · 0.80

Tested by 3

TestRequestMsgFunction · 0.64