queues

package module
v0.0.0-...-bbd30ba Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 4 Imported by: 0

README

queues

Package queues presents interface (and its implementation sets) of a queues.

See GoDoc for documentation and examples.

Documentation

Overview

Package queues presents interface (and its implementation sets) of a queues.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectedError

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

ConnectedError typifies error "race condition".

func NewConnectedError

func NewConnectedError(cause error) *ConnectedError

NewConnectedError - constructor ConnectedError based on the cause of the error.

func (*ConnectedError) Error

func (ce *ConnectedError) Error() string

Error returns an error message.

func (*ConnectedError) Format

func (ce *ConnectedError) Format(s fmt.State, v rune)

Format satisfies the interface fmt.Formatter.

func (*ConnectedError) FormatError

func (ce *ConnectedError) FormatError(p xerrors.Printer) (next error)

FormatError satisfies the interface xerrors.Formatter.

func (*ConnectedError) Unwrap

func (ce *ConnectedError) Unwrap() error

Unwrap satisfies the interface xerrors.Wrapper.

type Handler

type Handler func(msg Message) error

Handler predetermines the type of the basic function of the message handler.

type Message

type Message interface {
	// Body - provides the message body.
	Body() []byte
	// Timestamp - provides the message timestamp.
	Timestamp() int64
	// AttemptsCount provides message attempts count.
	AttemptsCount() uint16
	// QueueAddr - provides queue addr.
	QueueAddr() string
	// HasResponded - indicates whether or not this message has been responded to.
	HasResponded() bool
	// DisableAutoResponse - disables the automatic response that would normally be sent when a handler.
	DisableAutoResponse()
	// Touch - sends a touch command.
	Touch()
	// RequeueWithoutBackoff - sent this message, using the supplied delay.
	RequeueWithoutBackoff(delay time.Duration)
	// Finish - sends a finish command.
	Finish()
	// Context - provides message context.
	Context() context.Context
	// Subject - provides the message Subject.
	Subject() string
}

Message predetermines the message type for handler.

type Pinger

type Pinger interface {
	// Ping - ping queue,
	Ping(ctx context.Context) error
}

Pinger predetermines the type of the basic function of the ping action.

type Publisher

type Publisher interface {
	// Publish - publish message.
	Publish(ctx context.Context, subj string, body []byte) error
}

Publisher predetermines the type of the basic function of the publish action.

type QueueManager

type QueueManager interface {
	Publisher
	Pinger
	// Subscribe - subscribe to subj. Return Subscriber.
	Subscribe(ctx context.Context, subj string, handler Handler) (Subscriber, error)
	// Unsubscribe - unsubscribe Queue.
	Unsubscribe(ctx context.Context)
	// Stop - stop Queue.
	Stop(ctx context.Context)
}

QueueManager provides an interface for managing queue.

type Subscriber

type Subscriber interface {
	// Unsubscribe - unsubscribe Subscriber.
	Unsubscribe(ctx context.Context) error
	// Stop - stop Subscriber.
	Stop(ctx context.Context)
}

Subscriber predetermines the type of the basic function of the subscriber queue.

Directories

Path Synopsis
Package nsq represents the interface queues implementation.
Package nsq represents the interface queues implementation.

Jump to

Keyboard shortcuts

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