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

Struct AsyncProducer

mocks/async_producer.go:16–29  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

14// function in each expectation so that the message is checked by this function and
15// an error is returned if the match fails.
16type 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected