async-producer-consumer

command module
v0.0.0-...-ab6bc9b Latest Latest
Warning

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

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

README

Buffered, Async Producer - Consumer

This example shows a disconnected producer and consumer:

     ----------       --------       ----------
    | Consumer | <-- | Buffer | <-- | Producer |
     ----------       --------       ----------

Goal: Never block the Producer or Consumer IF there is a message available.

The Producer and Consumer can work at different rates. The size of the buffer is reported and it would be possible to mitigate if the size exceeded some threshold.

The Buffer can be Close()ed allowing the Producer to signal that it is done producing.

The Consumer receives both the next value and a 'more' flag indicating that there is potentially more data coming. Only when the producer Close()'s the buffer does it return more=false to the consumer.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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