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.
Click to show internal directories.
Click to hide internal directories.