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

Add request types to allow for mediator pattern invocation of tasks #121

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

jviau
Copy link
Member

@jviau jviau commented Feb 7, 2023

This PR introduces the mediator pattern for invoking of orchestrations and activities. This allows for users to invoke activities and orchestrations via strongly-typed request objects and also to build up complex invocation patterns through additional TaskOrchestrationContext extension methods and more derived request types. Some examples would be:

  1. A polling pattern. We can introduce a ILongRuningActivityRequest<TResult> and a RunAsync extension method for it which will handle enqueuing a polling orchestration and polling activity.
  2. A paging activity pattern - we can leverage our AsyncPageable<T> classes to allow for paging over activities via IAsyncEnumerable<T> in your code.

This will also replace the code-generation approach for strongly typed orchestration/activity invocations. In my opinion, I prefer this route over code-generation. It is more flexible and avoids function-name conflicts. We can still explore how we can leverage code-generation to add value to this pattern though - but it will always be an optional addition.

resolves #73

TODO:

  • unit tests
  • samples
  • DurableTaskClient extension method for enqueuing orchestrations.

@jviau jviau requested a review from cgillum February 7, 2023 19:34
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.

Adopt Mediator pattern to provide type-enforced invocations of orchestration and activities
2 participants