broker

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MessageIDKey = "message_id"

MessageIDKey defines the key that will be send the message unique identifier.

Variables

View Source
var (
	ErrEmptyTarMetadataKey            = errors.New("empty target metadata key")
	ErrMessageDoesNotMatchWithBrokers = errors.New("message does not match with any broker")
)

Errors ...

Functions

This section is empty.

Types

type Broker

type Broker interface {
	messenger.Publisher
}

Broker is the interface that wraps the basic message publishing.

type Mux added in v0.7.0

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

Mux contains multiple brokers and a metadata key to allow route messages depending on the metadata value of the message.

func NewMux added in v0.7.0

func NewMux(targetKey string) (*Mux, error)

NewMux returns an empty Mux target, if the targetKey is empty it returns ErrEmptyTarMetadataKey error.

func (*Mux) AddBroker added in v0.7.0

func (mb *Mux) AddBroker(value string, b Broker)

AddBroker registers the broker with the value filter.

func (Mux) Publish added in v0.7.0

func (mb Mux) Publish(ctx context.Context, msg messenger.Message) error

Publish routes the message to a broker depending if it matches the metadata key and metadata value. It it does not match it returns an error.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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