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)
| 129 | // |
| 130 | // Deprecated: Encoded connections are no longer supported. |
| 131 | func (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 |