unit_of_work¶
- class mersal.unit_of_work.UnitOfWorkConfig¶
Bases:
object
Configuration for unit of work feature.
- __init__(uow_factory: Callable[[MessageContext], Awaitable[UnitOfWorkT]], commit_action: Callable[[MessageContext, UnitOfWorkT], Awaitable], rollback_action: Callable[[MessageContext, UnitOfWorkT], Awaitable], close_action: Callable[[MessageContext, UnitOfWorkT], Awaitable], commit_with_transaction: bool = False) None ¶
- close_action: Callable[[MessageContext, UnitOfWorkT], Awaitable]¶
Action to run on close and cleanup the unit of work object.
Can be used to close database sessions for example.
- commit_with_transaction: bool = False¶
Commit before or with the
TransactionContext
commit.When True, the uow commit is part of the TransactionContext commit actions. This is required for the outbox and idempotency features to work.