العمارة القائمة على الأحداث (Event-driven architecture)
في هذه الصفحة 9 موضوعات
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
نظرة عامة
الموضوعات
- عقود الأحداث
- ملكية الأحداث
- تطور المخطط (schema evolution)
- إعادة التشغيل (replay)
تعلّم أولًا
4 ساعة تدريب (تقدير)
مخرجات التعلم
- Design event contracts (notification vs state transfer vs domain events) for consumers in other teams.
- Assign event ownership and publish an event catalog.
- Evolve schemas across teams with compatibility rules and versioned topics.
- Plan replay and backfill of events safely, including for consumers with side effects.
الدروس
- 01العمارة القائمة على الأحداث على مستوى المؤسسة
- 02أنواع الأحداث ومتى نستخدم كل نوع
- 03الملكية وكتالوجات الأحداث
- 04تطور المخطط عبر الفرق
- 05إعادة التشغيل والتعبئة الرجعية (Replay and backfill)
- 06عرض عملي: تصميم عقد الأحداث بين Shop وFulfillCo
- 07عرض عملي: إعادة تشغيل كانت ستعيد إرسال 40,000 بريد إلكتروني، والحل
المختبر والتمارين
Lab
SRB-002-LAB1 · Integration events
Outcomes: 1, 2, 3, 4 · Time: ~4 h
- List the business facts exchanged between Shop and FulfillCo (OrderReadyForFulfillment, ShipmentDispatched, ...).
- Define schemas, owners, topics, and compatibility rules for each.
- Write replay rules, flagging consumers with side effects.
- Hold a review with two role-played consuming teams and record their changes.
Acceptance: catalog reviewed by two role-played consuming teams; each event has owner, schema, and replay rule.
Exercises
| ID | Outcome | Task |
|---|---|---|
| SRB-002-EX01 | 1 | Classify three proposed events (OrderUpdated row dump, OrderPlaced, ShipmentDelayed ping) as notification, state transfer, or domain event. |
| SRB-002-EX02 | 1 | Write the OrderReadyForFulfillment schema for the warehouse team with privacy in mind. |
| SRB-002-EX03 | 2 | Who owns ShipmentDispatched? Write the catalog entry. |
| SRB-002-EX04 | 3 | A team wants to rename carrierCode to carrier. Describe the migration. |
| SRB-002-EX05 | 4 | Plan a backfill of 90 days of events to a new analytics consumer. |
| SRB-002-EX06 | 4 | Review a consumer that charges cards on PaymentRequested. Is replaying the topic safe? |
أظهر الحلول
- EX01 Row dump: leaked internal state; OrderPlaced: domain event; ping: notification. Redesign the row dump as a domain event.
- EX02 Order id, line items with SKU and quantity, promised date, minimal delivery reference; no payment data.
- EX03 FulfillCo-shipping; entry with topic, schema, sensitivity, consumers, replay-safe flag.
- EX04 Add the new optional field, publish both, migrate consumers, deprecate with a date, then remove in a new version.
- EX05 Throttle, use a separate consumer group, idempotent writes, verify counts, no side effects.
- EX06 No; require idempotency keys at the payment provider and a processed-event table.
Workplace evidence: an event contract you designed that another team consumes.
الاختبار
Outcomes: O1 contracts · O2 ownership and catalog · O3 schema evolution · O4 replay and backfill.
اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.
الجزء العملي
Contract review: review a peer's event contract against the checklist. Pass: 70% on the quiz and a review that finds at least three real issues in a flawed contract.
أخطاء شائعة
Leaking internal models as events; replays that resend customer emails.
التقييم
Contract review.
دليل من بيئة العمل
An event contract you designed that another team consumes.
الصلة بالمسار الوظيفي
Event architecture (ARC-026).