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 interfaces.
type Message ¶
type Message struct {
// ID is a unique identifier for the message.
ID string
// Metadata contains message metadata.
Metadata map[string]string
// Payload is the message content.
Payload []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.
Click to show internal directories.
Click to hide internal directories.