queue

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaxTimeNoRead = errors.New("no messages available in the queue for more than the max time")

ErrMaxTimeNoRead is returned by a queue reader when there were no messages available in the queue for more than the configured amount of time.

Functions

This section is empty.

Types

type Message

type Message struct {
	// Body contains the body of the message to be processed.
	Body string
	// TimesRead contains the number of times this concrete message has been
	// read so far.
	TimesRead int
}

Message defines the information a queue reader passes to a processor about a message.

type MessageProcessor

type MessageProcessor interface {
	FreeTokens() chan interface{}
	ProcessMessage(msg Message, token interface{}) <-chan bool
}

MessageProcessor defines the methods needed by a queue reader implementation to process the messages it reads.

type Reader

type Reader interface {
	StartReading(ctx context.Context) <-chan error
	LastMessageReceived() *time.Time
}

Reader defines the functions that all the concrete queue reader implementations must fullfil.

type Writer

type Writer interface {
	Write(body string) error
}

Writer defines the functions that a queue writer must implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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