Help us shape the future of Go! Take the 2026 Go Developer Survey

internal

package
v3.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(payload any) ([]byte, error)

Marshal marshals payload into bytes with zero-allocation fast paths.

func Unmarshal

func Unmarshal(data []byte, holder any) error

Unmarshal unmarshals data into holder with zero-copy where possible. holder must be a pointer.

Types

type AckID

type AckID any

AckID is the identifier of a message for purposes of acknowledgement.

type Message

type Message struct {
	// ID message identifier for recorded messages on the server.
	ID string

	// Body contains the content of the message.
	Body []byte

	// Metadata has key/value pairs describing the message.
	Metadata map[string]string
}

Message is data that moves around between client and server.

func (*Message) ByteSize

func (m *Message) ByteSize() int

ByteSize estimates the size in bytes of the message for the purpose of restricting batch sizes.

type Queue

type Queue interface {
	Send(ctx context.Context, ms ...*Message) error
	Receive(ctx context.Context, count int) ([]*Message, error)

	// Close cleans up any resources used by the Publisher.
	Close() error
}

type Subscriber

type Subscriber interface {
	Handle(ctx context.Context, ms *Message) error

	// Close cleans up any resources used by the Subscriber.
	Close() error
}

Jump to

Keyboard shortcuts

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