nonBlocking

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub[Message any] struct {
	// contains filtered or unexported fields
}

PubSub is a broadcaster that does not block when publishing without any subscribers

func New

func New[Message any]() *PubSub[Message]

func (*PubSub[Message]) Publish

func (b *PubSub[Message]) Publish(message Message) error

Publish a message to a topic without blocking, if the receiver is not ready to receive the message, the message will be dropped

func (*PubSub[Message]) Subscribe

func (b *PubSub[Message]) Subscribe(filter channel.MessageFilter[Message]) (<-chan Message, error)

func (*PubSub[Message]) Unsubscribe

func (b *PubSub[Message]) Unsubscribe(subscriber <-chan Message) error

Jump to

Keyboard shortcuts

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