queue

package
v1.69.13 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	AddPublisher(ctx context.Context, reference string, queueURL string) error
	GetPublisher(reference string) (Publisher, error)
	DiscardPublisher(ctx context.Context, reference string) error

	AddSubscriber(
		ctx context.Context,
		reference string,
		queueURL string,
		handlers ...SubscribeWorker,
	) error
	DiscardSubscriber(ctx context.Context, reference string) error
	GetSubscriber(reference string) (Subscriber, error)

	Publish(ctx context.Context, reference string, payload any, headers ...map[string]string) error
	Init(ctx context.Context) error
}

func NewQueueManager

func NewQueueManager(_ context.Context, workPool workerpool.Manager) Manager

type Publisher

type Publisher interface {
	Initiated() bool
	Ref() string
	Init(ctx context.Context) error

	Publish(ctx context.Context, payload any, headers ...map[string]string) error
	Stop(ctx context.Context) error
	As(i any) bool
}

type SubscribeWorker

type SubscribeWorker interface {
	Handle(ctx context.Context, metadata map[string]string, message []byte) error
}

type Subscriber

type Subscriber interface {
	Ref() string

	URI() string
	Initiated() bool
	State() SubscriberState
	Metrics() SubscriberMetrics
	IsIdle() bool

	Init(ctx context.Context) error
	Receive(ctx context.Context) (*pubsub.Message, error)
	Stop(ctx context.Context) error
	As(i any) bool
}

type SubscriberMetrics

type SubscriberMetrics interface {
	IsIdle(state SubscriberState) bool
	IdleTime(state SubscriberState) time.Duration
	AverageProcessingTime() time.Duration
}

type SubscriberState

type SubscriberState int
const (
	SubscriberStateWaiting SubscriberState = iota
	SubscriberStateProcessing
	SubscriberStateInError
)

Jump to

Keyboard shortcuts

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