memory

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package memory provides a message broker using memory.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidConnectionState indicate that the connection has not been opened properly.
	ErrInvalidConnectionState = errors.New("invalid connection state")
)

Functions

This section is empty.

Types

type Broker

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

Broker is a memory message broker.

func New

func New(opts ...Option) *Broker

New return new memory broker.

func (*Broker) CheckHealth

func (br *Broker) CheckHealth(ctx context.Context) error

CheckHealth implements health.Checker interface.

func (*Broker) Close

func (br *Broker) Close(ctx context.Context) error

Close implements broker.Broker interface.

func (*Broker) Open

func (br *Broker) Open(ctx context.Context) error

Open implements broker.Broker interface.

func (*Broker) Publish

func (br *Broker) Publish(ctx context.Context, topic string, m *broker.Message, opts ...broker.PublishOption) error

Publish implements broker.Broker interface.

func (*Broker) Subscribe

func (br *Broker) Subscribe(ctx context.Context, topic string, h broker.Handler, opts ...broker.SubscribeOption) (broker.Subscriber, error)

Subscribe implements broker.Broker interface.

type Option

type Option func(*Broker)

func Worker

func Worker(worker, buffer int) Option

Worker is an option to override the default number of worker and buffer.

Jump to

Keyboard shortcuts

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