Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose instance to workflows/activities and client to activities #393

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

cretz
Copy link
Member

@cretz cretz commented Jan 16, 2025

What was changed

  • Add Temporalio.Workflows.Workflow.Instance to give access to the literal instance of the workflow class
  • Add Temporalio.Extensions.Hosting.ActivityScope for activity scope information
    • This DI extension the only place .NET creates the user's instance for them
    • Provides both the ServiceScope and the ScopedInstance used by DI
    • Has advanced used for primary-execute-activity interceptor users to make their own scope or instance if needed since the instance is not available until inside the root call of the interceptor
  • Add Temporalio.Activities.ActivityExecutionContext.TemporalClient to give access to Temporal client
    • Users can make test instances without this, which will throw on access
    • Users can technically make workers with a more generic IWorkerClient interface that is not the full client, which will throw on access
  • Minor test refactoring and fix for tests since new dev server release

Checklist

  1. Closes [Feature Request] Access to workflow/activity instance from context #388
  2. Closes [Feature Request] Provide client from activity context #389

@cretz cretz marked this pull request as ready for review January 16, 2025 14:35
@cretz cretz requested a review from a team January 16, 2025 14:35
@cretz cretz force-pushed the instance-and-activity-client branch from 4878b6f to 5cfb754 Compare January 16, 2025 14:54
@cretz cretz force-pushed the instance-and-activity-client branch from 5cfb754 to 1cb8e1c Compare January 16, 2025 16:30
@cretz cretz merged commit 3dd6cca into temporalio:main Jan 16, 2025
8 checks passed
@cretz cretz deleted the instance-and-activity-client branch January 16, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants