RequestMsg will send a request payload including optional headers and deliver the response message, or an error, including a timeout if no message was received properly.
(msg *Msg, timeout time.Duration)
| 4610 | // RequestMsg will send a request payload including optional headers and deliver |
| 4611 | // the response message, or an error, including a timeout if no message was received properly. |
| 4612 | func (nc *Conn) RequestMsg(msg *Msg, timeout time.Duration) (*Msg, error) { |
| 4613 | if msg == nil { |
| 4614 | return nil, ErrInvalidMsg |
| 4615 | } |
| 4616 | hdr, err := msg.headerBytes() |
| 4617 | if err != nil { |
| 4618 | return nil, err |
| 4619 | } |
| 4620 | |
| 4621 | return nc.request(msg.Subject, hdr, msg.Data, timeout) |
| 4622 | } |
| 4623 | |
| 4624 | // Request will send a request payload and deliver the response message, |
| 4625 | // or an error, including a timeout if no message was received properly. |