Messaging Foundations
ไอเดียในประโยคเดียว
หัวข้อที่มีชื่อว่า “ไอเดียในประโยคเดียว”RabbitMQ คือ message broker: infrastructure ที่วางอยู่ตรงกลางระหว่าง service ที่ ผลิต งาน กับ service ที่ ทำ งาน เพื่อให้สองฝั่งไม่ต้องคุยกันตรง ๆ producer โยน message เข้า RabbitMQ แล้วไปทำอย่างอื่นต่อ ส่วน consumer ก็หยิบไปทำเมื่อพร้อม
การมีตัวกลางคั่นตรงนี้ — buffer ตรงกลาง — คือหัวใจทั้งหมด ทำให้ระบบรับมือกับ spike ได้, ทนต่อการที่ consumer ล่ม และ scale สองฝั่งแยกจากกันได้
โมดูลนี้ครอบคลุมอะไรบ้าง
หัวข้อที่มีชื่อว่า “โมดูลนี้ครอบคลุมอะไรบ้าง”| บทเรียน | สิ่งที่คุณจะได้เรียน |
|---|---|
| What is a message queue? | ปัญหาที่ async messaging แก้ — decoupling, buffering และ resilience |
| RabbitMQ & AMQP | RabbitMQ คืออะไร และ AMQP 0-9-1 model ที่ RabbitMQ implement |
| Core concepts | producer, consumer, connection, channel, exchange, queue, binding, message |
| Your first queue | publish และ consume message ใน Node, Python และ Go |
ทำไมต้องเริ่มที่นี่
หัวข้อที่มีชื่อว่า “ทำไมต้องเริ่มที่นี่”เกือบทุก feature ของ RabbitMQ — exchange, acknowledgement, dead-letter queue, confirm — ล้วนเป็นการต่อยอดจาก flow ง่าย ๆ อันเดียว จำภาพนี้ไว้ในหัวก่อน:
flowchart LR prod["Producer (ส่งงาน)"] -->|publish| ex["Exchange (route)"] ex -->|binding| q["Queue (buffer)"] q -->|deliver| cons["Consumer (ทำงาน)"]
producer publish ไปที่ exchange จากนั้น exchange route message ไปยัง queue หนึ่งตัวหรือหลายตัว แล้ว consumer อ่านจาก queue เหล่านั้น producer ไม่เคยรู้เลยว่าใครเป็นคน consume, เมื่อไร หรือมี consumer กี่ตัว ทุกอย่างที่ตามมาคือเรื่องของการควบคุมและทำให้ flow นี้แข็งแรงขึ้น