messagequeue

package
v0.3.0-20260803204450-... Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	// ID uniquely identifies the message for deduplication and tracing.
	ID string

	// Payload is the message body as raw bytes.
	Payload []byte

	// Metadata contains key-value pairs for headers and attributes.
	// Use for trace IDs, request IDs, and cross-service metadata.
	Metadata map[string]string

	// PartitionKey determines which partition/shard this message goes to.
	// Messages with the same PartitionKey are guaranteed ordered delivery.
	// Optional - if empty, backend may use round-robin distribution.
	PartitionKey string

	// PublishedAt is when the message was published (Unix milliseconds).
	PublishedAt int64
}

Message represents a queue message entity. Immutable - use Copy() for modifications.

func NewMessage

func NewMessage(id string, payload []byte, partitionKey string, metadata map[string]string) Message

NewMessage creates a new message with the given ID, payload, partition key, and metadata. If metadata is nil, it will be initialized as an empty map. PublishedAt is set to the current time.

func (Message) Copy

func (m Message) Copy() Message

Copy creates a deep copy of the message. Safe to call concurrently.

Jump to

Keyboard shortcuts

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