queue

package
v1.1.3-0...-a28cbea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAvailablePusher = errors.New("no available pusher")

Functions

This section is empty.

Types

type BalancedPusher

type BalancedPusher struct {
	// contains filtered or unexported fields
}

func (*BalancedPusher) Name

func (pusher *BalancedPusher) Name() string

func (*BalancedPusher) Push

func (pusher *BalancedPusher) Push(message string) error

type Consumer

type Consumer interface {
	Consume(string) error
	OnEvent(event interface{})
}

type ConsumerFactory

type ConsumerFactory func() (Consumer, error)

type Listener

type Listener interface {
	OnPause()
	OnResume()
}

type MessageQueue

type MessageQueue interface {
	Start()
	Stop()
}

type MultiPusher

type MultiPusher struct {
	// contains filtered or unexported fields
}

func (*MultiPusher) Name

func (pusher *MultiPusher) Name() string

func (*MultiPusher) Push

func (pusher *MultiPusher) Push(message string) error

type Poller

type Poller interface {
	Name() string
	Poll() string
}

type ProduceListener

type ProduceListener interface {
	OnProducerPause()
	OnProducerResume()
}

type Producer

type Producer interface {
	AddListener(listener ProduceListener)
	Produce() (string, bool)
}

type ProducerFactory

type ProducerFactory func() (Producer, error)

type Pusher

type Pusher interface {
	Name() string
	Push(string) error
}

func NewBalancedPusher

func NewBalancedPusher(pushers []Pusher) Pusher

func NewMultiPusher

func NewMultiPusher(pushers []Pusher) Pusher

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(producerFactory ProducerFactory, consumerFactory ConsumerFactory) *Queue

func (*Queue) AddListener

func (queue *Queue) AddListener(listener Listener)

func (*Queue) Broadcast

func (queue *Queue) Broadcast(message interface{})

func (*Queue) SetName

func (queue *Queue) SetName(name string)

func (*Queue) SetNumConsumer

func (queue *Queue) SetNumConsumer(count int)

func (*Queue) SetNumProducer

func (queue *Queue) SetNumProducer(count int)

func (*Queue) Start

func (queue *Queue) Start()

func (*Queue) Stop

func (queue *Queue) Stop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL