ReadMessage reads the message at the current offset from the connection, advancing the offset on success so the next call to a read method will produce the next message. Because this method allocate memory buffers for the message key and value it is less memory-efficient than Read, but has the adva
(maxBytes int)
| 728 | // This method is provided for convenience purposes but is much less efficient |
| 729 | // than using the more general purpose ReadBatch method. |
| 730 | func (c *Conn) ReadMessage(maxBytes int) (Message, error) { |
| 731 | batch := c.ReadBatch(1, maxBytes) |
| 732 | msg, err := batch.ReadMessage() |
| 733 | return msg, coalesceErrors(silentEOF(err), batch.Close()) |
| 734 | } |
| 735 | |
| 736 | // ReadBatch reads a batch of messages from the kafka server. The method always |
| 737 | // returns a non-nil Batch value. If an error occurred, either sending the fetch |