MCPcopy
hub / github.com/segmentio/kafka-go / ReadMessage

Method ReadMessage

conn.go:730–734  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

728// This method is provided for convenience purposes but is much less efficient
729// than using the more general purpose ReadBatch method.
730func (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

Callers 15

testConnSeekDontCheckFunction · 0.45
testReaderReadCanceledFunction · 0.45
testReaderReadMessagesFunction · 0.45
testReaderSetOffsetAtFunction · 0.45
testReaderLagFunction · 0.45
testReaderReadLagFunction · 0.45

Calls 4

ReadBatchMethod · 0.95
coalesceErrorsFunction · 0.85
silentEOFFunction · 0.85
CloseMethod · 0.45

Tested by 15

testConnSeekDontCheckFunction · 0.36
testReaderReadCanceledFunction · 0.36
testReaderReadMessagesFunction · 0.36
testReaderSetOffsetAtFunction · 0.36
testReaderLagFunction · 0.36
testReaderReadLagFunction · 0.36