queue

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemQueue

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

MemQueue is an in-process storage.Queue.

Messages live only in memory, so nothing survives a restart and nothing is shared between instances. It is the default so that a single-instance deployment needs no broker; use a Redis-backed queue for anything else.

func NewMemQueue

func NewMemQueue(size int) *MemQueue

NewMemQueue returns a queue buffering up to size messages. A size of zero or less uses the default.

func (*MemQueue) Close

func (q *MemQueue) Close() error

func (*MemQueue) Publish

func (q *MemQueue) Publish(ctx context.Context, msg storage.Message) error

func (*MemQueue) Start

func (q *MemQueue) Start(ctx context.Context) error

func (*MemQueue) String

func (q *MemQueue) String() string

String identifies the backend, which is what the deprecated AdapterQueue interface reports through storage.LegacyQueueAdapter.

func (*MemQueue) Subscribe

func (q *MemQueue) Subscribe(topic string, h storage.Handler) error

type Memory

type Memory struct {
	PoolNum uint
	// contains filtered or unexported fields
}

func NewMemory

func NewMemory(poolNum uint) *Memory

NewMemory 内存模式

func (*Memory) Append

func (m *Memory) Append(message storage.Messager) error

func (*Memory) Register

func (m *Memory) Register(name string, f storage.ConsumerFunc)

func (*Memory) Run

func (m *Memory) Run()

func (*Memory) Shutdown

func (m *Memory) Shutdown()

func (*Memory) String

func (*Memory) String() string

type Message

type Message struct {
	ID         string
	Stream     string
	Values     map[string]interface{}
	ErrorCount int
	// contains filtered or unexported fields
}

func (*Message) GetErrorCount

func (m *Message) GetErrorCount() int

func (*Message) GetID

func (m *Message) GetID() string

func (*Message) GetPrefix

func (m *Message) GetPrefix() (prefix string)

func (*Message) GetStream

func (m *Message) GetStream() string

func (*Message) GetValues

func (m *Message) GetValues() map[string]interface{}

func (*Message) SetErrorCount

func (m *Message) SetErrorCount(count int)

func (*Message) SetID

func (m *Message) SetID(id string)

func (*Message) SetPrefix

func (m *Message) SetPrefix(prefix string)

func (*Message) SetStream

func (m *Message) SetStream(stream string)

func (*Message) SetValues

func (m *Message) SetValues(values map[string]interface{})

Jump to

Keyboard shortcuts

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