Channels - Junior¶
Channels carry values between concurrent tasks. An unbuffered channel synchronizes sender and receiver; a buffered channel allows limited decoupling.
flowchart LR
Reader -->|record| C[(Channel capacity 100)] --> Transformer
C -.full: sender waits.-> Reader
Use a bounded channel between ETL stages. Send immutable values or transfer ownership. The sender closes after producing all values; the receiver drains until closed. Never use closure to mean “one worker finished” when other senders remain.
Continue to middle.md.
Test yourself¶
- How do buffered and unbuffered channels differ?
- Who should close a channel?
- What does a full bounded channel do?