RabbitMQ
في هذه الصفحة 8 موضوعات
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
نظرة عامة
الموضوعات
- المبادلات (Exchanges)
- التوجيه (Routing)
- الإقرارات (Acknowledgments)
- طوابير الرسائل الميتة (Dead-Letter Queues)
تعلّم أولًا
2.5 ساعة تدريب (تقدير)
مخرجات التعلم
- Explain exchanges (direct, topic, fanout), bindings, and queues.
- Publish and consume with Spring AMQP using manual acknowledgments.
- Configure dead-letter exchanges and retry with delay.
- Decide between RabbitMQ and Kafka for a workload.
الدروس
المختبر والتمارين
Lab
MID-027-LAB1 · Notifications
Outcomes: 1–4 · Time: ~2.5 h
- Build a notification service with Spring AMQP, consuming
emailandsmsqueues bound to a topic exchange with routing keys. - Use manual acknowledgments and a prefetch limit.
- Add a TTL retry queue (3 attempts) and a final dead-letter queue.
- 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)
| ID | Outcome | Task |
|---|---|---|
| MID-027-EX01 | 1 | Write the routing key patterns so one queue gets all order.* events and another only order.cancelled. |
| MID-027-EX02 | 1 | Name the exchange type for: exact routing, pattern routing, broadcast. |
| MID-027-EX03 | 2 | Convert an auto-ack listener to manual ack and explain the failure it removes. |
| MID-027-EX04 | 3 | Declare a queue with a dead-letter exchange and a 10-second delayed retry back to the main queue. |
| MID-027-EX05 | 4 | Scenario: 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 andorder.cancelledto the second (exact keys also match topic patterns). - EX02 Direct, topic, fanout.
- EX03 Set manual acknowledge mode;
basicAckafter success,basicNack(tag, false, false)on failure. Removes loss of unprocessed messages on a crash. - EX04
QueueBuilder.durable("main").deadLetterExchange("dlx"); a retry queue withx-message-ttl=10000andx-dead-letter-exchangepointing 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.
اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.
الجزء العملي
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).