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

أنماط العمارة الموزّعة

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

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

نظرة عامة

الموضوعات

  • CQRS
  • التزويد بالأحداث (event sourcing)
  • Sagas
  • التنسيق (orchestration)
  • العروض المادية (materialized views)

تعلّم أولًا

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

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

  1. Apply full CQRS with separate write and read models, and say when CQRS-lite is enough.
  2. Explain event sourcing (event store, projections, snapshots, upcasting) and its operational costs.
  3. Build materialized views across service boundaries and manage their staleness.
  4. Choose between orchestration engines (e.g., Temporal, Camunda) and hand-built sagas.

الدروس

  1. 01الأنماط كمفاضلات وليست ترقيات
  2. 02CQRS بالتفصيل
  3. 03Event sourcing
  4. 04الإسقاطات (Projections) واللقطات (Snapshots) والترقية (Upcasting)
  5. 05العروض المادية عبر الخدمات
  6. 06محركات سير العمل مقابل Sagas المبنية يدويًا
  7. 07عرض عملي: نمذجة تتبع الشحنات مع Event sourcing وبدونه
  8. 08عرض عملي: إعادة بناء إسقاط معطوب من مخزن الأحداث

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

Lab

SRB-001-LAB1 · Shipment tracking design

Outcomes: 1, 2, 3, 4 · Time: ~4.5 h

  1. List FulfillCo's shipment tracking requirements (status, history, corrections, partner feed, audit).
  2. Design option A: event-sourced; option B: state plus outbox.
  3. Estimate replay time, schema evolution effort, and storage for each at expected volume.
  4. Write an ADR with the decision, rejected option, and revisit triggers.

Acceptance: operational costs (replay time, schema evolution, storage) estimated for both options; ADR records the decision.

Exercises

IDOutcomeTask
SRB-001-EX011Your read screens need a different shape but load is light. Choose CQRS-lite or full CQRS and justify.
SRB-001-EX022List three costs of event sourcing for shipment tracking that a state table would not have.
SRB-001-EX032A v1 event lacks a field the new projection needs. Describe the upcasting approach.
SRB-001-EX043Shop shows carrier status from FulfillCo. Define acceptable staleness and the reconciliation job.
SRB-001-EX054Three workflows exist, each two steps with no timers. Engine or hand-built saga? Argue.
SRB-001-EX061Review a proposal to event-source the product catalog. Write a five-line critique.
أظهر الحلول
  • EX01 CQRS-lite: SQL views or separate read classes on the same database; full CQRS adds a second store and lag for no needed gain.
  • EX02 Replay time for rebuilds, permanent event schema and upcasting work, harder ad hoc queries and deletion of personal data.
  • EX03 Add an upcaster mapping v1 to v2 with a default or derived value on read; do not rewrite history unless unavoidable.
  • EX04 e.g. status within 30 s of the event, timestamp shown; a nightly job compares counts per status and repairs gaps by re-consuming.
  • EX05 Hand-built with an outbox and state table: small, short, no timers; revisit if workflows grow.
  • EX06 Catalog history is rarely business-critical, reads dominate, edits are simple; an audit history table suffices; propose a spike measuring need first.

Workplace evidence: a design where you chose a simpler pattern over a fashionable one and could show why.

الاختبار

Outcomes: O1 CQRS · O2 event sourcing · O3 materialized views · O4 orchestration choice.

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

  1. 1What defines CQRS-lite?O1
  2. 2Which is the strongest reason for full CQRS?O1
  3. 3In event sourcing, current state is obtained by:O2
  4. 4A snapshot is used to:O2
  5. 5Upcasting means:O2
  6. 6A cross-service materialized view is best described as:O3
  7. 7Staleness of a view should be:O3
  8. 8A hand-built saga is usually enough when:O4
  9. 9A projection nobody can rebuild is a problem because:O2
  10. 10Adopting a workflow engine for a single saga is typically:O4

الجزء العملي

Pattern-selection defense: present the ADR from SRB-001-LAB1 and defend it against challenges. Pass: 70% on the quiz and an ADR with costs estimated for both options.

أخطاء شائعة

Event sourcing everything; projections nobody can rebuild; workflow engines adopted for one saga.

التقييم

Pattern-selection defense.

دليل من بيئة العمل

A design where you chose a simpler pattern over a fashionable one and could show why.

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

Architecture at scale (SRA-001).

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