broker

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package broker defines a generic interface for a message broker.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	Publisher
	Subscriber
}

Broker combines the Publisher and Subscriber contracts.

type Message

type Message interface {
	GetId() string
	GetMetadata() map[string]string
	GetPayload() []byte
}

Message is a generic message structure.

type Publisher

type Publisher interface {
	// Publish sends messages to a topic.
	Publish(ctx context.Context, topic string, messages ...Message) error
	// Close terminates the publisher's connection.
	Close() error
}

Publisher defines the interface for publishing messages.

type Subscriber

type Subscriber interface {
	// Subscribe returns a channel of messages for a given topic.
	Subscribe(ctx context.Context, topic string) (<-chan Message, error)
	// Close terminates the subscriber's connection.
	Close() error
}

Subscriber defines the interface for subscribing to messages.

Jump to

Keyboard shortcuts

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