notifier

package
v0.0.0-...-3273997 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSubscriptionManagerClosed = fmt.Errorf("subscription manager closed")

Functions

func SplitByBatchProcess

func SplitByBatchProcess[TItem any](values <-chan TItem, maxItems int, maxTimeout time.Duration) <-chan []TItem

SplitByBatchProcess batch processor that will split a channel into batches of a maximum size or after a maximum timeout. main idea from https://elliotchance.medium.com/batch-a-channel-by-size-or-time-in-go-92fa3098f65

Types

type SubscriptionManager

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

func NewSubscriptionManager

func NewSubscriptionManager[T any](logger *logger.Logger, shutdownCloser *graceful.ShutdownCloser) *SubscriptionManager[T]

func (*SubscriptionManager[T]) AddSubscriber

func (manager *SubscriptionManager[T]) AddSubscriber(ctx context.Context, uniqSubscriberId string) (chan []T, error)

func (*SubscriptionManager[T]) Close

func (manager *SubscriptionManager[T]) Close() error

func (*SubscriptionManager[T]) Notify

func (manager *SubscriptionManager[T]) Notify(events ...T)

func (*SubscriptionManager[T]) RemoveSubscriber

func (manager *SubscriptionManager[T]) RemoveSubscriber(key string)

Jump to

Keyboard shortcuts

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