I RabbitMQ er en connection en TCP-forbindelse til broker'en, mens en channel er en let virtuel forbindelse inden for en connection. Det er vigtigt for effektivitet og en almindelig best practice at bruge channels korrekt (i stedet for mange connections).
Connections vs channels
CONNECTION → a TCP connection to the RabbitMQ broker:
→ relatively HEAVY (a real network connection, with overhead to establish/maintain)
CHANNEL → a lightweight, virtual connection MULTIPLEXED over a single TCP connection:
→ many channels share one connection → lightweight; most operations happen on channels
→ publishing, consuming, declaring queues → done via channels
→ one connection can have MANY channels (multiplexing reduces TCP overhead)
