AsyncProducer implements sarama's Producer interface for testing purposes. Before you can send messages to it's Input channel, you have to set expectations so it knows how to handle the input; it returns an error if the number of messages received is bigger then the number of expectations set. You c
| 14 | // function in each expectation so that the message is checked by this function and |
| 15 | // an error is returned if the match fails. |
| 16 | type AsyncProducer struct { |
| 17 | l sync.Mutex |
| 18 | t ErrorReporter |
| 19 | expectations []*producerExpectation |
| 20 | closed chan struct{} |
| 21 | input chan *sarama.ProducerMessage |
| 22 | successes chan *sarama.ProducerMessage |
| 23 | errors chan *sarama.ProducerError |
| 24 | isTransactional bool |
| 25 | txnLock sync.Mutex |
| 26 | txnStatus sarama.ProducerTxnStatusFlag |
| 27 | lastOffset int64 |
| 28 | *TopicConfig |
| 29 | } |
| 30 | |
| 31 | // NewAsyncProducer instantiates a new Producer mock. The t argument should |
| 32 | // be the *testing.T instance of your test method. An error will be written to it if |
nothing calls this directly
no outgoing calls
no test coverage detected