multichannel

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSendFailed = errors.New("send failed")
)

Functions

This section is empty.

Types

type Topic

type Topic[T any] struct {
	// contains filtered or unexported fields
}

func NewTopic

func NewTopic[T any](clone messaging.MessageCloneFunc[T], subChannelSize int) *Topic[T]

NewTopic returns a new instance of messaging.Topic

func NewTopicWithDefaults

func NewTopicWithDefaults[T any]() *Topic[T]

func (*Topic[T]) Publish

func (t *Topic[T]) Publish(ctx context.Context, message T) (err error)

Publish sends a message to all subscribers of this topic in parallel All subscribers must be able to receive the message or this function will block

func (*Topic[T]) Subscribe

func (t *Topic[T]) Subscribe(_ context.Context) (stream messaging.Stream[T], err error)

Subscribe returns a channel that will receive messages published to this topic

Jump to

Keyboard shortcuts

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