Orchestration that receives multiple events
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 335
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 6
Description
Can anyone share an example of an orchestration that receives multiple events?
I'm trying to create an orchestration that will wait for an event, process that event, and then wait for the next event, in an "endless" loop. Something along the lines of (NON WORKING CODE BELOW):
``` csharp
public class SignalOrchestration : TaskOrchestration
{
TaskCompletionSource resumeHandle;
public override async Task RunTask(OrchestrationContext context, string input)
{
do
{
string job = await WaitForSignal();
await context.ScheduleTask("ExecuteJob", string.Empty, job);
}
while (true);
return string.Empty;
}
async Task WaitForSignal()
{
this.resumeHandle = new TaskCompletionSource();
string data = await this.resumeHandle.Task;
return data;
}
public override void OnEvent(OrchestrationContext context, string name, string input)
{
this.resumeHandle?.SetResult(input);
}
}
```
and I should be able to send events to this orchestration.
The idea is to have something similar to an Actor - the orchestration representing a resource, and I'd like to handle the jobs on the resource as they arrive...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.