queue

package
v1.10.35 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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