Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoAvailablePusher = errors.New("no available pusher")
ErrNoAvailablePusher indicates no pusher available.
Functions ¶
This section is empty.
Types ¶
type BalancedPusher ¶
type BalancedPusher struct {
// contains filtered or unexported fields
}
A BalancedPusher is used to push messages to multiple pusher with round robin algorithm.
func (*BalancedPusher) Name ¶
func (pusher *BalancedPusher) Name() string
Name returns the name of pusher.
func (*BalancedPusher) Push ¶
func (pusher *BalancedPusher) Push(message string) error
Push pushes message to one of the underlying pushers.
type ConsumerFactory ¶
ConsumerFactory defines the factory to generate consumers.
type Listener ¶
type Listener interface { OnPause() OnResume() }
A Listener interface represents a listener that can be notified with queue events.
type MessageQueue ¶
type MessageQueue interface { Start() Stop() }
A MessageQueue interface represents a message queue.
type MultiPusher ¶
type MultiPusher struct {
// contains filtered or unexported fields
}
A MultiPusher is a pusher that can push messages to multiple underlying pushers.
func (*MultiPusher) Name ¶
func (pusher *MultiPusher) Name() string
Name returns the name of pusher.
func (*MultiPusher) Push ¶
func (pusher *MultiPusher) Push(message string) error
Push pushes a message into the underlying queue.
type ProduceListener ¶
type ProduceListener interface { OnProducerPause() OnProducerResume() }
A ProduceListener interface represents a produce listener.
type Producer ¶
type Producer interface { AddListener(listener ProduceListener) Produce() (string, bool) }
A Producer interface represents a producer that produces messages.
type ProducerFactory ¶
ProducerFactory defines the method to generate a Producer.
type Pusher ¶
A Pusher interface wraps the method Push.
func NewBalancedPusher ¶
NewBalancedPusher returns a BalancedPusher.
func NewMultiPusher ¶
NewMultiPusher returns a MultiPusher.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
A Queue is a message queue.
func NewQueue ¶
func NewQueue(producerFactory ProducerFactory, consumerFactory ConsumerFactory) *Queue
NewQueue returns a Queue.
func (*Queue) AddListener ¶
AddListener adds a listener to q.
func (*Queue) SetNumConsumer ¶
SetNumConsumer sets the number of consumers.
func (*Queue) SetNumProducer ¶
SetNumProducer sets the number of producers.