messagebroker

package
v0.0.0-...-834ce46 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerService

type BrokerService struct {
	Consumer  Consumer  // Represents the consumer interface for interacting with the message broker.
	Publisher Publisher // Represents the publisher interface for interacting with the message broker.
}

BrokerService represents a service that interacts with a message broker.

func NewBroker

func NewBroker(consumer Consumer, publisher Publisher) *BrokerService

NewBroker creates a new instance of BrokerService with the provided consumer and publisher implementations.

type Consumer

type Consumer interface {
	// ConsumeMessage consumes messages on the specified topic.
	ConsumeMessage(topic string) (<-chan Message, error)

	// Close closes the consumer.
	Close() error
}

Consumer defines the interface for a message consumer.

type Message

type Message struct {
	ID      uuid.UUID
	Topic   string
	Payload []byte
}

Message represents a message in the pub/sub system.

func NewMessage

func NewMessage(topic string, payload []byte) Message

NewMessage creates a new message with the given topic, payload, and metadata.

type Publisher

type Publisher interface {
	// PublishMessage publishes messages to a specified topic.
	PublishMessage(topic string, messages ...Message) error

	// Close closes the publisher.
	Close() error
}

Publisher defines the interface for a message publisher.

Jump to

Keyboard shortcuts

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