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

Use expression trees for all type-safe remote calls (💥 BREAKING CHANGES) #75

Merged
merged 3 commits into from
May 25, 2023

Conversation

cretz
Copy link
Member

@cretz cretz commented May 24, 2023

What was changed

We have removed the concept of "Ref" and replaced with expression trees. Primary reasons:

  • "Ref" approach was too unfamiliar to .NET devs
  • "Ref" approach required implementers to add something when they implemented
  • Expression trees are more familiar even if they have slight shortcomings (e.g. performance of interpreting complex arg expressions and not everything like optional/named parameters accepted)
  • Expression trees allow for fewer overloads to support 0, 1, N-arg calls
  • Expression trees allow us to store the type of workflow on the workflow handle, child workflow handle, and external workflow handle allowing us to enforce that type-safe signal and query calls are on the same workflow

💥 BREAKING CHANGES:

The following calls were changed to support expression trees instead of "Ref":

  • Temporalio.Client.ITemporalClient.ExecuteWorkflowAsync (extension)
  • Temporalio.Client.ITemporalClient.StartWorkflowAsync
  • Temporalio.Client.Schedules.ScheduleActionStartWorkflow.Create
  • Temporalio.Client.WorkflowHandle.QueryAsync
  • Temporalio.Client.WorkflowHandle.SignalAsync
  • Temporalio.Workflows.ChildWorkflowHandle.SignalAsync
  • Temporalio.Workflows.ExternalWorkflowHandle.SignalAsync
  • Temporalio.Workflows.Workflow.CreateContinueAsNewException
  • Temporalio.Workflows.Workflow.ExecuteActivityAsync
  • Temporalio.Workflows.Workflow.ExecuteChildWorkflowAsync
  • Temporalio.Workflows.Workflow.ExecuteLocalActivityAsync
  • Temporalio.Workflows.Workflow.StartChildWorkflowAsync

Any previous use of these is now likely as compiler error. To get an idea of what the changes look like from a caller POV, see the tests/Temporalio.Tests/Worker/WorkflowWorkerTests.cs file.

Checklist

  1. Closes [Feature Request] Change Ref approach to expression-based #62

@cretz cretz requested a review from a team May 24, 2023 22:25
Copy link
Member Author

Choose a reason for hiding this comment

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

Note, in a subsequent PR, I will be moving all Temporalio top-namespace-level types to Temporalio.Common, this just happens to be the first

Copy link
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Skimmed this, overall LGTM

# Conflicts:
#	.github/workflows/ci.yml
#	tests/Temporalio.Tests/Worker/WorkflowWorkerTests.cs
@cretz cretz force-pushed the expression-trees branch from a33a701 to 995f530 Compare May 25, 2023 14:49
@cretz cretz merged commit bbb10ab into temporalio:main May 25, 2023
@cretz cretz deleted the expression-trees branch May 25, 2023 19:58
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.

[Feature Request] Change Ref approach to expression-based
2 participants