Skip to content

Commit 4153fdf

Browse files
author
Вадим Козыревский
committed
Исправил документацию
1 parent b6f15bb commit 4153fdf

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

docs/mermaid/saga.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ from cqrs.saga.mermaid import SagaMermaid
2222
from cqrs.saga.saga import Saga
2323
from cqrs.saga.storage.memory import MemorySagaStorage
2424

25-
# Create your saga (see Saga Pattern documentation for details)
26-
saga = Saga(
27-
steps=[ReserveInventoryStep, ProcessPaymentStep, ShipOrderStep],
28-
container=container,
29-
storage=MemorySagaStorage(),
30-
)
25+
# Create your saga class (steps are defined as class attribute)
26+
class OrderSaga(Saga[OrderContext]):
27+
steps = [ReserveInventoryStep, ProcessPaymentStep, ShipOrderStep]
28+
29+
# Create saga instance
30+
saga = OrderSaga()
3131

3232
# Create Mermaid generator
3333
generator = SagaMermaid(saga)
@@ -93,11 +93,14 @@ class ProcessPaymentStep(SagaStepHandler[OrderContext, ProcessPaymentResponse]):
9393
class ShipOrderStep(SagaStepHandler[OrderContext, ShipOrderResponse]):
9494
# ... implementation
9595

96-
saga = Saga(
97-
steps=[ReserveInventoryStep, ProcessPaymentStep, ShipOrderStep],
98-
container=container,
99-
storage=storage,
100-
)
96+
class OrderSaga(Saga[OrderContext]):
97+
steps = [
98+
ReserveInventoryStep,
99+
ProcessPaymentStep,
100+
ShipOrderStep,
101+
]
102+
103+
saga = OrderSaga()
101104
```
102105

103106
### Generated Sequence Diagram

0 commit comments

Comments
 (0)