You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
usingMicrosoft.Extensions.DependencyInjection;usingMicrosoft.Extensions.Hosting;usingTemporalio.Client;usingTemporalio.Extensions.Hosting;usingTemporalio.Worker;usingTemporalio.Workflows;asyncTaskRunAsync(){// Start workflowvarclient=awaitTemporalClient.ConnectAsync(new("localhost:7233"));awaitclient.StartWorkflowAsync((MyWorkflowwf)=>wf.RunAsync(),new(id:$"wf-{Guid.NewGuid()}","my-task-queue"));// Run worker (change to false and this will start working)constbooluseHostBuilder=true;try{if(useHostBuilder){varbuilder=Host.CreateApplicationBuilder();builder.Services.AddHostedTemporalWorker("localhost:7233","default","my-task-queue").AddWorkflow<MyWorkflow>();varhost=builder.Build();// Change next line to "await host.RunAsync();" and it will start workinghost.Run();}else{varworker=newTemporalWorker(client,newTemporalWorkerOptions("my-task-queue").AddWorkflow<MyWorkflow>());awaitworker.ExecuteAsync(default);}}catch(OperationCanceledException){Console.WriteLine("Workers cancelled");}}awaitRunAsync();[Workflow]publicclassMyWorkflow{[WorkflowRun]publicTask<string>RunAsync()=>Task.FromResult("done");}
It doesn't poll, but if you change host.Run() to host.RunAsync() it works. Very strange. So document that in the Temporalio.Extensions.Hosting README. Also document the caveat about issue 36063 in https://github.com/dotnet/runtime (not linking by intention) which trips people up and is a known issue.
The text was updated successfully, but these errors were encountered:
Describe the solution you'd like
Look at this snippet:
It doesn't poll, but if you change
host.Run()
tohost.RunAsync()
it works. Very strange. So document that in theTemporalio.Extensions.Hosting
README. Also document the caveat about issue 36063 in https://github.com/dotnet/runtime (not linking by intention) which trips people up and is a known issue.The text was updated successfully, but these errors were encountered: