Skip to content

Commit

Permalink
Clarify RunAsync caveat
Browse files Browse the repository at this point in the history
  • Loading branch information
cretz committed Apr 24, 2024
1 parent 21a9ff5 commit ac0e482
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Temporalio.Extensions.Hosting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ builder.Services.
AddScopedActivities<MyActivityClass>().
AddWorkflow<MyWorkflow>();

// Run
var host = builder.Build();
host.Run();
// Make sure you use RunAsync and not Run, see https://github.com/temporalio/sdk-dotnet/issues/220
await host.RunAsync();
```

This creates a hosted Temporal worker which returns a builder. Then `MyActivityClass` is added to the service collection
Expand Down Expand Up @@ -91,6 +91,9 @@ are available as parameters that can be configured. `TemporalWorkerServiceOption
`TemporalWorkerOptions` with an added property for optional client options that can be set to connect a client on worker
start instead of expecting a `ITemporalClient` to be present on the service collection.

⚠️WARNING: Make sure you use host `RunAsync()` and not `Run()` (see
[this](https://github.com/temporalio/sdk-dotnet/issues/220) issue)

## Activity Dependency Injection without Worker Services

Some users may prefer to manually create the `TemporalWorker` without using host support, but still make their
Expand Down

0 comments on commit ac0e482

Please sign in to comment.