dispatcher

package
v0.0.0-...-8f3027a Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0, Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockingDispatcher

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

BlockingDispatcher blocks on an input channel until stop, and broadcasts each input message to all output channels. Blocks until all output channels have consumed a message, before pulling in the next input message.

func NewBlockingDispatcher

func NewBlockingDispatcher[T any](input <-chan T) (*BlockingDispatcher[T], error)

NewBlockingDispatcher returns a BlockingDispatcher which will consume messages from the input channel. Dispatcher must be started with Start(ctx). Stopped by cancelling ctx.

func (*BlockingDispatcher[T]) DispatchForever

func (d *BlockingDispatcher[T]) DispatchForever(ctx context.Context, outputs ...chan T)

DispatchForever is stopped by cancelling ctx. Loops Forever, pulling from input, and sending to all outputs. All output channels must consume messages promptly to keep dispatcher from blocking.

Jump to

Keyboard shortcuts

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