broker

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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