Skip to content

Conversation

andystaples
Copy link
Contributor

@andystaples andystaples commented Sep 26, 2025

Add support for durable entities to this SDK

Also fixes a related bug: When the orchestration yields with CompleteOrchestration, we were discarding any pending actions - we need to keep these around for "side effects" actions like unlocking or signaling entities, which the user may expect to complete when the orchestration finishes.
Another issue with the side effects was discovered in the DTS backend, PR is linked in the test comments and the relevant test will need to be re-enabled once the fix is merged.

See the included documentation/samples/tests for usage guidelines.

Reviewers: Request special attention to file structures, naming, docs and tests

Discussion points:

  • Optional parameters to some of the entity requests, like start time and cancellation tokens - should these be implemented now or later?
  • Typing for entity calls - look at TInput/TOutput for activities, compare with entities (abstraction because of EntityInstanceId)
  • Class-based entities - should we have the object state represent the entity state, or preserve the get_state & from_state behavior here (research into the dotnet SDK required)

- Return pending actions when orchestrations complete
- Ensure locked entities are unlocked when orchestration ends (success/fail/continue_as_new)
- Provide default "delete" operation and document deleting entities


class EntityLock:
# Note: This should
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will clean this up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge - you can clean it up in a follow up PR.

return self

def __exit__(self, exc_type, exc_val, exc_tb):
self._context._exit_critical_section()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do this with a callback, where we just pass the _exit_critical_section method insetad of the whole OrchestrationContext, I just worry if it abstracts things a little too much. Feedback welcome

@berndverst berndverst merged commit 48830dc into main Oct 8, 2025
18 checks passed
@berndverst berndverst deleted the andystaples/add-durable-entities branch October 8, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants