انتقل إلى المحتوى
أمين أبوزيد
MID-027

RabbitMQ

  • 6 درس
  • 2.5 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • المبادلات (Exchanges)
  • التوجيه (Routing)
  • الإقرارات (Acknowledgments)
  • طوابير الرسائل الميتة (Dead-Letter Queues)

تعلّم أولًا

2.5 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Explain exchanges (direct, topic, fanout), bindings, and queues.
  2. Publish and consume with Spring AMQP using manual acknowledgments.
  3. Configure dead-letter exchanges and retry with delay.
  4. Decide between RabbitMQ and Kafka for a workload.

الدروس

  1. 01نموذج RabbitMQ
  2. 02المبادلات والتوجيه
  3. 03الإقرارات وprefetch
  4. 04طوابير الرسائل الميتة وإعادة المحاولة المؤجلة
  5. 05RabbitMQ أم Kafka؟
  6. 06عرض عملي: توجيه الإشعارات باستخدام topic exchange

المختبر والتمارين

Lab

MID-027-LAB1 · Notifications

Outcomes: 1–4 · Time: ~2.5 h

  1. Build a notification service with Spring AMQP, consuming email and sms queues bound to a topic exchange with routing keys.
  2. Use manual acknowledgments and a prefetch limit.
  3. Add a TTL retry queue (3 attempts) and a final dead-letter queue.
  4. Send a poison message and normal messages together.

Acceptance: a poison message ends in the DLQ without blocking others.

Exercises (assessment: lab plus tool-choice scenario; five exercises)

IDOutcomeTask
MID-027-EX011Write the routing key patterns so one queue gets all order.* events and another only order.cancelled.
MID-027-EX021Name the exchange type for: exact routing, pattern routing, broadcast.
MID-027-EX032Convert an auto-ack listener to manual ack and explain the failure it removes.
MID-027-EX043Declare a queue with a dead-letter exchange and a 10-second delayed retry back to the main queue.
MID-027-EX054Scenario: a 20 TB event history must be replayable by new services; another need is delayed email jobs. Pick a broker for each.
أظهر الحلول
  • EX01 Bind order.* to the first queue and order.cancelled to the second (exact keys also match topic patterns).
  • EX02 Direct, topic, fanout.
  • EX03 Set manual acknowledge mode; basicAck after success, basicNack(tag, false, false) on failure. Removes loss of unprocessed messages on a crash.
  • EX04 QueueBuilder.durable("main").deadLetterExchange("dlx"); a retry queue with x-message-ttl=10000 and x-dead-letter-exchange pointing to the main exchange.
  • EX05 Replayable history: Kafka. Delayed jobs: RabbitMQ with TTL and DLX (or plugin).
  • Outcome 2 is also exercised by the lab (manual acks, prefetch).

الاختبار

Outcomes: O1 exchanges and bindings · O2 Spring AMQP and acks · O3 DLX and retry · O4 RabbitMQ vs Kafka.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1Producers in RabbitMQ publish to:O1
  2. 2Which exchange copies a message to every bound queue?O1
  3. 3In a topic exchange * matches:O1
  4. 4With auto-ack, a consumer crash during processing:O2
  5. 5With manual acks, when should you ack?O2
  6. 6Prefetch limits:O2
  7. 7A message is dead-lettered when it:O3
  8. 8Delayed retry without a plugin is commonly built with:O3
  9. 9Infinite redelivery of a poison message is stopped by:O3
  10. 10Which need most favors Kafka over RabbitMQ?O4

الجزء العملي

Five exercises MID-027-EX01 to EX05 plus the lab. Pass: at least four exercises correct and the lab's poison message landing in the DLQ while normal messages are still processed.

أخطاء شائعة

Auto-ack; infinite redelivery loops.

التقييم

Lab plus tool-choice scenario.

الصلة بالمسار الوظيفي

Enterprise integration (ARC-009).

اكتب للبحث في المستويات والمراحل والوحدات والدروس.