التنسيق المركزي (Orchestration)
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
coordinate a saga with an explicit orchestrator.
الموضوعات المخطط لها
- An orchestrator owns the process: sends commands, waits for replies, decides the next step.
- The flow is in one place: easier to read, test, add timeouts, and monitor.
- Cost: an extra component and the risk of putting business rules in it; keep it about sequencing only.
- Persist the saga state so a restart resumes where it stopped.
- Rule of thumb: choreography for short, stable flows; orchestration for longer, branching, or time-sensitive ones.
تفاصيل المخطط المبدئي
عرض عملي
enum SagaState { STARTED, STOCK_RESERVED, PAID, COMPLETED, COMPENSATING, FAILED }
record OrderSaga(UUID orderId, SagaState state, Instant deadline, int version) {}اختبر فهمك
Why persist saga state?
أظهر الإجابة
So a crash or restart resumes the process instead of losing it.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.