MCPcopy
hub / github.com/IBM/sarama / SetMessageWithKey

Method SetMessageWithKey

mockresponses.go:315–330  ·  view source on GitHub ↗
(topic string, partition int32, offset int64, key, msg Encoder)

Source from the content-addressed store, hash-verified

313}
314
315func (mfr *MockFetchResponse) SetMessageWithKey(topic string, partition int32, offset int64, key, msg Encoder) *MockFetchResponse {
316 mfr.messagesLock.Lock()
317 defer mfr.messagesLock.Unlock()
318 partitions := mfr.messages[topic]
319 if partitions == nil {
320 partitions = make(map[int32]map[int64]*mockMessage)
321 mfr.messages[topic] = partitions
322 }
323 messages := partitions[partition]
324 if messages == nil {
325 messages = make(map[int64]*mockMessage)
326 partitions[partition] = messages
327 }
328 messages[offset] = newMockMessage(key, msg)
329 return mfr
330}
331
332func (mfr *MockFetchResponse) SetHighWaterMark(topic string, partition int32, offset int64) *MockFetchResponse {
333 partitions := mfr.highWaterMarks[topic]

Callers 2

SetMessageMethod · 0.95

Calls 1

newMockMessageFunction · 0.85

Tested by 1