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

messaging

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package messaging publishes and reads inter-agent messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service wraps messaging.Store with domain logic.

func NewService

func NewService(store messaging.Store, cfg *config.Config, bus *events.EventBus) *Service

NewService creates a new Service.

func (*Service) Acknowledge

func (m *Service) Acknowledge(ctx context.Context, consumerID string, messageIDs []string) error

Acknowledge marks messages as read by a consumer.

func (*Service) GenerateTopic

func (m *Service) GenerateTopic(prefix string) string

GenerateTopic creates a new topic name using the configured prefix and a random suffix.

func (*Service) GetUnread

func (m *Service) GetUnread(ctx context.Context, consumerID string, topic string) ([]messaging.Message, error)

GetUnread returns messages not yet acknowledged by consumer.

func (*Service) ListTopics

func (m *Service) ListTopics(ctx context.Context) ([]string, error)

ListTopics returns all topic names.

func (*Service) Prune

func (m *Service) Prune(ctx context.Context, olderThan time.Duration) (int, error)

Prune removes messages older than the given duration.

func (*Service) Publish

func (m *Service) Publish(ctx context.Context, msg messaging.Message, topics []string) (messaging.PublishResult, error)

Publish adds a message to multiple topics. Returns the resolved topics after wildcard expansion.

func (*Service) Subscribe

func (m *Service) Subscribe(ctx context.Context, topic string, since time.Time) ([]messaging.Message, error)

Subscribe returns all messages for a topic, optionally filtered by since timestamp.

Jump to

Keyboard shortcuts

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