var ErrQueueClosed = errors.New("the queue is closed for reading and writing")
MessageQueue represents a threadsafe message queue to be used to retrieve or write messages to.
type MessageQueue struct {
// contains filtered or unexported fields
}
func NewMessageQueue() *MessageQueue
NewMessageQueue returns a new MessageQueue.
func (mq *MessageQueue) Close()
Close closes the queue for future writes or reads. Any attempts to read or write from the queue after close will return ErrQueueClosed. This is safe to call multiple times.
func (mq *MessageQueue) Dequeue() (interface{}, error)
Dequeue will read a value from the queue and remove it. If the queue is empty, this will block until the queue is closed or a value gets enqueued.
func (mq *MessageQueue) Enqueue(msg interface{}) error
Enqueue writes `msg` to the queue.
func (mq *MessageQueue) Size() int
Size returns the size of the queue.