You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 1. Create SQLAlchemy Engine with Connection Pool
144
-
# SQLAlchemy creates a pool by default (QueuePool for most dialects, SingletonThreadPool for SQLite)
145
143
"""
146
144
Run a demonstration that executes an OrderSaga using an async SQLAlchemy engine and persistent SqlAlchemySagaStorage.
147
-
145
+
148
146
Initializes a pooled async SQLAlchemy engine and schema, creates a session factory and SqlAlchemySagaStorage, bootstraps a mediator with a DI container and saga mapper, runs an OrderSaga while streaming step results to stdout, and then reloads and prints the persisted saga state and step history before disposing the engine.
149
147
"""
148
+
# 1. Create SQLAlchemy Engine with Connection Pool
149
+
# SQLAlchemy creates a pool by default (QueuePool for most dialects, SingletonThreadPool for SQLite)
tuple[SagaStatus, dict[str, Any], int]: A tuple containing the saga's global status, the latest persisted context (JSON-serializable), and the current optimistic-locking version number.
96
101
"""
97
-
...
102
+
98
103
asyncdefget_step_history(
99
104
self,
100
105
saga_id: uuid.UUID,
101
-
) ->list[SagaLogEntry]: """
106
+
) ->list[SagaLogEntry]:
107
+
"""
102
108
Retrieve the chronological step log for a saga.
103
109
104
110
Parameters:
@@ -107,19 +113,20 @@ async def get_step_history(
107
113
Returns:
108
114
list[SagaLogEntry]: Ordered list of step log entries for the saga, from oldest to newest.
109
115
"""
110
-
...
111
-
asyncdefcommit(self) ->None: """
112
-
Finalize the storage run by persisting and committing all pending changes made during this session.
113
-
114
-
This method makes the run's checkpointed changes durable; the caller is responsible for invoking commit at logical checkpoints to persist session state.
115
-
"""
116
-
...
117
-
asyncdefrollback(self) ->None: """
118
-
Abort the current storage run and revert any uncommitted changes in the session.
119
-
120
-
This releases the run's transactional state without persisting pending updates so that the storage remains as it was before the run began.
121
-
"""
122
-
...
116
+
117
+
asyncdefcommit(self) ->None:
118
+
"""
119
+
Finalize the storage run by persisting and committing all pending changes made during this session.
120
+
121
+
This method makes the run's checkpointed changes durable; the caller is responsible for invoking commit at logical checkpoints to persist session state.
122
+
"""
123
+
124
+
asyncdefrollback(self) ->None:
125
+
"""
126
+
Abort the current storage run and revert any uncommitted changes in the session.
127
+
128
+
This releases the run's transactional state without persisting pending updates so that the storage remains as it was before the run began.
0 commit comments