queue

package
v0.0.0-...-09c63dc Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Author:ydy Date: Desc:

Author:ydy Date: Desc:

Author:ydy Date: Desc:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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()
}

A Listener interface represents a listener that can be notified with queue events.

type Poller

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

A Poller interface wraps the method Poll.

type Producer

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

type ProducerFactory

type ProducerFactory func() (Producer, error)

type ProducerListener

type ProducerListener interface {
	OnProducerPause()
	OnProducerResume()
}

type Pusher

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

A Pusher interface wraps the method Push.

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

func (*Queue) AddListener

func (m *Queue) AddListener(listener Listener)

func (*Queue) BroadEventCast

func (m *Queue) BroadEventCast(message interface{})

func (*Queue) SetName

func (m *Queue) SetName(name string)

func (*Queue) SetNumConsumer

func (m *Queue) SetNumConsumer(count int)

SetNumConsumer sets the number of consumers.

func (*Queue) SetNumProducer

func (m *Queue) SetNumProducer(count int)

SetNumProducer sets the number of producers.

func (*Queue) Start

func (m *Queue) Start()

func (*Queue) Stop

func (m *Queue) Stop()

Jump to

Keyboard shortcuts

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