شرح التبادلات والطوابير والارتباطات
تعلّموا لبنات التوجيه الأساسية في RabbitMQ — التبادلات والطوابير والارتباطات — وكيف تنتقل الرسائل من المنتجين إلى المستهلكين.
شرح التبادلات والطوابير والارتباطات درس مجاني في RabbitMQ Messaging & Async Systems على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في RabbitMQ Messaging & Async Systems، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة RabbitMQ Messaging & Async Systems 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
The Routing Trio
Producers don't publish to queues directly. Three pieces route a message: an exchange receives it, a binding links it, and a queue stores it.
What Is an Exchange?
An exchange is the entry point. A producer publishes to it, and the exchange decides which queues should get the message based on its rules.
What Is a Binding?
A binding is the rule connecting an exchange to a queue, usually with a routing key or pattern that decides whether a message matches.
Direct Exchange
A direct exchange routes to queues whose binding key exactly matches the message's routing key — ideal for point-to-point routing.
channel.exchangeDeclare('logs_direct', 'direct');
channel.queueBind('errors', 'logs_direct', 'error');Fanout Exchange
A fanout exchange ignores routing keys and broadcasts every message to all bound queues. Perfect for pub/sub where everyone needs everything.
Topic Exchange
A topic exchange routes by wildcard pattern: * matches one word, # matches many. So order.* catches order.created and order.shipped.
Headers Exchange
A headers exchange routes on message header attributes instead of a routing key — the most flexible type, and the least used.
The Default Exchange
The nameless default exchange binds every queue by its own name. Publish with a routing key equal to a queue name and it lands there directly.
Declaring a Queue
Declare a queue before using it, and mark it durable so it survives a broker restart. The code does exactly that.
channel.queueDeclare('tasks', true, false, false, null);Putting the Flow Together
The full flow: a producer publishes to an exchange with a routing key, bindings match, the right queues store it, and consumers read.
Choosing an Exchange Type
Picking an exchange type: exact key → direct, broadcast → fanout, pattern → topic, header rules → headers.
Quick Check
You picked an exchange type. Now match the routing behavior to the job.
Recap
That's RabbitMQ routing: exchanges route, queues store, bindings connect — and direct, fanout, and topic each shape how messages flow.
الأسئلة الشائعة
هل درس «شرح التبادلات والطوابير والارتباطات» مجاني؟
نعم — نص درس «شرح التبادلات والطوابير والارتباطات» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة RabbitMQ Messaging & Async Systems، انتقل إلى CoddyKit PRO. تتضمن دورة RabbitMQ Messaging & Async Systems 4 دروس في المجموع.
ماذا ستتعلم في «شرح التبادلات والطوابير والارتباطات»؟
تعلّموا لبنات التوجيه الأساسية في RabbitMQ — التبادلات والطوابير والارتباطات — وكيف تنتقل الرسائل من المنتجين إلى المستهلكين. تتمرن على RabbitMQ Messaging & Async Systems مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ RabbitMQ Messaging & Async Systems؟
لا تُشترط خبرة سابقة. RabbitMQ Messaging & Async Systems على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «شرح التبادلات والطوابير والارتباطات»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس RabbitMQ Messaging & Async Systems هذا؟
نعم. كل درس في RabbitMQ Messaging & Async Systems يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- ما قوائم انتظار الرسائل؟
- شرح معمارية RabbitMQ
- إعداد RabbitMQ محليًا
- شرح التبادلات والطوابير والارتباطات