oldRequest will create an Inbox and perform a Request() call with the Inbox reply and return the first reply received. This is optimized for the case of multiple responses.
(subj string, hdr, data []byte, timeout time.Duration)
| 4686 | // with the Inbox reply and return the first reply received. |
| 4687 | // This is optimized for the case of multiple responses. |
| 4688 | func (nc *Conn) oldRequest(subj string, hdr, data []byte, timeout time.Duration) (*Msg, error) { |
| 4689 | inbox := nc.NewInbox() |
| 4690 | ch := make(chan *Msg, RequestChanLen) |
| 4691 | |
| 4692 | s, err := nc.subscribe(inbox, _EMPTY_, nil, ch, nil, true, nil) |
| 4693 | if err != nil { |
| 4694 | return nil, err |
| 4695 | } |
| 4696 | s.AutoUnsubscribe(1) |
| 4697 | defer s.Unsubscribe() |
| 4698 | |
| 4699 | err = nc.publish(subj, inbox, false, hdr, data) |
| 4700 | if err != nil { |
| 4701 | return nil, err |
| 4702 | } |
| 4703 | |
| 4704 | return s.NextMsg(timeout) |
| 4705 | } |
| 4706 | |
| 4707 | // InboxPrefix is the prefix for all inbox subjects. |
| 4708 | const ( |
no test coverage detected