producer.go 430 B

123456789101112131415161718
  1. package queue
  2. type (
  3. // A Producer interface represents a producer that produces messages.
  4. Producer interface {
  5. AddListener(listener ProduceListener)
  6. Produce() (string, bool)
  7. }
  8. // A ProduceListener interface represents a produce listener.
  9. ProduceListener interface {
  10. OnProducerPause()
  11. OnProducerResume()
  12. }
  13. // ProducerFactory defines the method to generate a Producer.
  14. ProducerFactory func() (Producer, error)
  15. )