messaging

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: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PassThoughClone

func PassThoughClone[T any](t T) (T, error)

Types

type Broker

type Broker[T any] interface {
	Topic(string) (Topic[T], error)
}

type ChannelStream

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

func NewChannelStream

func NewChannelStream[T any](channel chan T, cleanup func()) *ChannelStream[T]

func (ChannelStream[T]) Channel

func (c ChannelStream[T]) Channel() (stream <-chan T)

func (ChannelStream[T]) Next

func (c ChannelStream[T]) Next(ctx context.Context) (message T, hasNext bool, err error)

func (ChannelStream[T]) Unsubscribe

func (c ChannelStream[T]) Unsubscribe()

type Consumer

type Consumer[T any] interface {
	Subscribe(ctx context.Context) (stream Stream[T], err error)
}

type Event

type Event[T any] struct {
	ID   uuid.UUID
	Data T
}

func NewEvent

func NewEvent[T any](data T) Event[T]

type MessageCloneFunc

type MessageCloneFunc[T any] func(T) (T, error)

type Publisher

type Publisher[T any] interface {
	Publish(ctx context.Context, message T) (err error)
}

type Stream

type Stream[T any] interface {
	Unsubscribe()
	Channel() (stream <-chan T)
	Next(ctx context.Context) (message T, hasNext bool, err error)
}

type Topic

type Topic[T any] interface {
	Publisher[T]
	Consumer[T]
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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