Skip to content

Commit

Permalink
[Host.Outbox] Support for UUIDv7 values and MSSQL side ID generation,…
Browse files Browse the repository at this point in the history
… flexible PK types, refactor

Signed-off-by: Tomasz Maruszak <[email protected]>
  • Loading branch information
zarusz committed Oct 24, 2024
1 parent 19fed04 commit c492eb2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ protected async virtual ValueTask DisposeAsyncCore()

public async virtual Task BeginTransaction()
{
if (_transactionCompleted)
{
throw new MessageBusException("Transaction was completed already");
}

if (_transactionCount == 0)
{
// Start transaction
await OnBeginTransaction();
_transactionFailed = false;
_transactionCompleted = false;
_transactionCount++;
}
_transactionCount++;
}

private async Task TryCompleteTransaction(bool transactionFailed = false)
Expand All @@ -59,6 +64,7 @@ private async Task TryCompleteTransaction(bool transactionFailed = false)
if (!_transactionCompleted && (_transactionCount == 0 || transactionFailed))
{
_transactionCompleted = true;
_transactionCount = 0;
await OnCompleteTransaction(_transactionFailed);
}
}
Expand Down

0 comments on commit c492eb2

Please sign in to comment.