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

Method YieldMessage

mocks/consumer.go:386–403  ·  view source on GitHub ↗

Expectation API YieldMessage will yield a messages Messages channel of this partition consumer when it is consumed. By default, the mock consumer will not verify whether this message was consumed from the Messages channel, because there are legitimate reasons forthis not to happen. ou can call Exp

(msg *sarama.ConsumerMessage)

Source from the content-addressed store, hash-verified

384// reasons forthis not to happen. ou can call ExpectMessagesDrainedOnClose so it will
385// verify that the channel is empty on close.
386func (pc *PartitionConsumer) YieldMessage(msg *sarama.ConsumerMessage) *PartitionConsumer {
387 pc.l.Lock()
388 defer pc.l.Unlock()
389
390 msg.Topic = pc.topic
391 msg.Partition = pc.partition
392
393 if pc.paused {
394 msg.Offset = pc.suppressedHighWaterMarkOffset
395 pc.suppressedHighWaterMarkOffset++
396 pc.suppressedMessages <- msg
397 } else {
398 msg.Offset = pc.highWaterMarkOffset.Add(1) - 1
399 pc.messages <- msg
400 }
401
402 return pc
403}
404
405// YieldError will yield an error on the Errors channel of this partition consumer
406// when it is consumed. By default, the mock consumer will not verify whether this error was

Implementers 2

PartitionConsumermocks/consumer.go

Calls 1

AddMethod · 0.45