pubsub

package
v2.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0, BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	// ID identifies this message.
	ID string `json:"id,omitempty"`

	// Data is the actual data in the entry.
	Data []byte `json:"data"`

	// Labels represents the key-value pairs the entry is labeled with.
	Labels map[string]string `json:"labels,omitempty"`
}

Message defines a published message.

type Publisher

type Publisher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New() *Publisher

New creates an in-memory publisher.

func (*Publisher) Publish

func (p *Publisher) Publish(message Message)

func (*Publisher) Subscribe

func (p *Publisher) Subscribe(c context.Context, receiver Receiver)

type Receiver

type Receiver func(Message)

Receiver receives published messages.

Jump to

Keyboard shortcuts

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