المهارات saga-orchestration
📦

saga-orchestration

آمن

Implement Saga Patterns for Distributed Transactions

متاح أيضًا من: wshobson

Coordinate multi-step business processes across microservices with reliable compensation handling when failures occur.

يدعم: Claude Codex Code(CC)
🥉 73 برونزي
1

تنزيل ZIP المهارة

2

رفع في Claude

اذهب إلى Settings → Capabilities → Skills → Upload skill

3

فعّل وابدأ الاستخدام

اختبرها

استخدام "saga-orchestration". Create a saga orchestrator for order processing with payment and inventory steps

النتيجة المتوقعة:

A Python class implementing SagaOrchestrator with define_steps method returning SagaStep objects, async methods for start, handle_step_completed, and handle_step_failed with proper state transitions

استخدام "saga-orchestration". Show how to handle compensation for a failed payment in an order saga

النتيجة المتوقعة:

Compensation logic that iterates through completed steps in reverse order, publishing compensation events like RefundPayment and ReleaseInventory to undo the effects of successful steps

التدقيق الأمني

آمن
v1 • 2/24/2026

All 19 static findings are false positives. The pattern-matching scanner misidentified Python code templates as Ruby shell execution, markdown text as cryptographic algorithms, and service names in diagrams as C2 indicators. The skill contains legitimate saga orchestration patterns for distributed systems with no security risks.

2
الملفات التي تم فحصها
526
الأسطر التي تم تحليلها
3
النتائج
1
إجمالي عمليات التدقيق
مشكلات متوسطة المخاطر (3)
Pattern Matching False Positives
Scanner flagged Python code blocks as 'Ruby/shell backtick execution'. The code uses legitimate Python syntax (import, dataclass, async/await) for saga templates.
Misidentified Markdown Content
Scanner flagged text patterns as 'weak cryptographic algorithm' and 'C2 keywords'. These are normal text: best practices, table headers, and service names in ASCII diagrams.
Hardcoded URLs - Legitimate References
Two URLs referenced in the resources section are legitimate technical references: microservices.io pattern documentation and a published book.
تم تدقيقه بواسطة: claude

درجة الجودة

38
الهندسة المعمارية
100
قابلية الصيانة
87
المحتوى
50
المجتمع
90
الأمان
100
الامتثال للمواصفات

ماذا يمكنك بناءه

E-commerce Order Processing

Implement multi-step order fulfillment with inventory reservation, payment processing, and shipping orchestration with automatic rollback on failures.

Financial Transaction workflows

Create reliable financial processes with atomic compensation for multi-step transfers, refunds, and reconciliation tasks.

Cross-Service Approval Systems

Build approval workflows that coordinate across multiple services with automatic compensation if approvals are revoked or expire.

جرّب هذه الموجهات

Basic Saga Structure
Create a Python saga orchestrator base class that manages saga state (Started, Pending, Compensating, Completed, Failed) with methods for starting a saga, handling step completion, and executing compensation in reverse order on failure.
Order Fulfillment Workflow
Implement an OrderFulfillmentSaga that coordinates reserve_inventory, process_payment, create_shipment, and send_confirmation steps with appropriate compensation actions for each step.
Choreography-Based Events
Create an event-driven choreography saga that uses an event bus to publish and subscribe to events like OrderCreated, InventoryReserved, PaymentProcessed, and ShipmentCreated without a central orchestrator.
Saga with Timeout Handling
Extend the saga orchestrator to include timeout handling for each step. Add scheduled timeout checks that trigger compensation if a step does not complete within the configured time window.

أفضل الممارسات

  • Always design compensation actions before implementing forward actions - compensation must be reliable
  • Use idempotency keys for all commands to safely handle duplicate messages without side effects
  • Store correlation IDs across all events and logs to trace saga execution across service boundaries

تجنب

  • Do not assume saga steps complete instantly - always implement async handling and state persistence
  • Do not skip compensation testing - simulate failure at every step and verify rollback works
  • Do not couple services directly - use async event messaging to maintain loose coupling

الأسئلة المتكررة

What is the difference between orchestration and choreography saga patterns?
Orchestration uses a central coordinator that directs all steps. Choreography uses events where each service reacts to events from other services. Orchestration provides better visibility and control; choreography offers lower coupling.
How do compensations work in saga patterns?
Compensations are undo actions that reverse the effects of completed steps. They run in reverse order when a step fails. For example, if payment succeeds but shipping fails, the compensation would refund the payment.
What happens if a compensation also fails?
The saga enters a Failed state after compensation completes. Operators should be notified for manual intervention. Design compensations to be idempotent and reliable to minimize this scenario.
How do timeouts work in saga patterns?
Timeouts are tracked per step. If a step does not complete within the timeout window, the saga treats it as a failure and triggers compensation. Use a scheduler to check for timed-out steps.
Can saga patterns handle duplicate messages?
Yes, by using idempotency keys. Each command includes a unique key, and handlers check if the key was already processed before executing the action. This prevents double-charging or double-shipping.
When should I not use saga patterns?
Avoid sagas when you need strong consistency (ACID transactions), when operations are very short and can use local transactions, or when the business process is simple enough for a single service.

تفاصيل المطور

المؤلف

sickn33

الترخيص

MIT

مرجع

main

بنية الملفات