PublishMsg publishes the Msg structure, which includes the Subject, an optional Reply and an optional Data field.
(m *Msg)
| 4363 | // PublishMsg publishes the Msg structure, which includes the |
| 4364 | // Subject, an optional Reply and an optional Data field. |
| 4365 | func (nc *Conn) PublishMsg(m *Msg) error { |
| 4366 | if m == nil { |
| 4367 | return ErrInvalidMsg |
| 4368 | } |
| 4369 | hdr, err := m.headerBytes() |
| 4370 | if err != nil { |
| 4371 | return err |
| 4372 | } |
| 4373 | validateReply := m.Reply != _EMPTY_ |
| 4374 | return nc.publish(m.Subject, m.Reply, validateReply, hdr, m.Data) |
| 4375 | } |
| 4376 | |
| 4377 | // PublishRequest will perform a Publish() expecting a response on the |
| 4378 | // reply subject. Use Request() for automatically waiting for a response |