Skip to content

Add an ambient transaction behavior #272

Description

@kzu

Summary

Ship a behavior that runs next inside an ambient transaction supplied by the caller: a TransactionScope, or a small unit-of-work the caller implements.

API

The behavior takes a factory that starts the transaction and returns an object the behavior can complete or abandon. TransactionScope is the built-in case. The unit-of-work shape is Complete() plus Dispose().

Behavior

  • Start the transaction before next. Complete it when the attempt succeeds. Dispose it without completing when the attempt throws or the awaitable faults.
  • For Task and ValueTask, complete only after Proceed has observed success.
  • Sit inside each retry attempt. A failed attempt rolls back, and the next attempt starts a new transaction. The cache sits inside this transaction.

Acceptance

  • A successful call completes the scope once.
  • A thrown exception leaves the scope incomplete and disposes it.
  • A faulted task does the same.
  • A retry gets a new scope on every attempt.

Composition

Outer to inner: observation, resilience, transaction, cache, target.

Back this issue
Back this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions