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)
| 384 | // reasons forthis not to happen. ou can call ExpectMessagesDrainedOnClose so it will |
| 385 | // verify that the channel is empty on close. |
| 386 | func (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 |