Skip to content

Commit 5531bfe

Browse files
GSmithAppscretz
andauthored
proposed readme nits (#455)
Co-authored-by: Chad Retz <chad@temporal.io>
1 parent 4fed10a commit 5531bfe

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ using Temporalio.Converters;
310310
public class CamelCasePayloadConverter : DefaultPayloadConverter
311311
{
312312
public CamelCasePayloadConverter()
313-
: base(new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })
313+
: base(new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })
314314
{
315315
}
316316
}
@@ -423,7 +423,7 @@ public class GreetingWorkflow
423423
// WARNING: Workflow updates are experimental
424424
[WorkflowUpdate]
425425
public async Task UpdateGreetingParamsAsync(GreetingParams greetingParams) =>
426-
this.greetingParamsUpdate = greetingParams;
426+
this.greetingParamsUpdate = greetingParams;
427427

428428
[WorkflowSignal]
429429
public async Task CompleteWithGreetingAsync() => this.complete = true;
@@ -441,20 +441,20 @@ Notes about the above code:
441441
different signal
442442
* Workflow code must be deterministic. See the "Workflow Logic Constraints" section below.
443443
* `Workflow.ExecuteActivityAsync` is strongly typed and accepts a lambda expression. This activity call can be a sync or
444-
async function, return a value or not, and invoked statically or on an instance (which would require accepting the
444+
async function, return a value or not, and be invoked statically or on an instance (which would require accepting the
445445
instance as the only lambda parameter).
446446

447447
Attributes that can be applied:
448448

449449
* `[Workflow]` attribute must be present on the workflow type.
450450
* The attribute can have a string argument for the workflow type name. Otherwise the name is defaulted to the
451451
unqualified type name (with the `I` prefix removed if on an interface and has a capital letter following).
452-
* `Dynamic = true` can be set for the workflow which makes the workflow a dynamic workflow meaning it will be called
452+
* `Dynamic = true` can be set for the workflow, which makes the workflow a dynamic workflow -- meaning it will be called
453453
when no other workflows match. The run call must accept a single parameter of `Temporalio.Converters.IRawValue[]`
454454
for the arguments. Only one dynamic workflow may be registered on a worker.
455455
* `[WorkflowRun]` attribute must be present on one and only one public method.
456456
* The workflow run method must return a `Task` or `Task<>`.
457-
* The workflow run method _should_ accept a single parameter and return a single type. Records are encouraged because
457+
* The workflow run method _should_ accept a single parameter and return a single type, for example, a Record. Single types/Records are encouraged because
458458
optional fields can be added without affecting backwards compatibility of the workflow definition.
459459
* The parameters of this method and its return type are considered the parameters and return type of the workflow
460460
itself.
@@ -463,6 +463,8 @@ Attributes that can be applied:
463463
just invokes the base class method.
464464
* `[WorkflowSignal]` attribute may be present on any public method that handles signals.
465465
* Signal methods must return a `Task`.
466+
* Similar to `[WorkflowRun]`, The signal method _should_ accept a single parameter of a single type, for example, a Record. Single types/Records are encouraged because
467+
optional fields can be added without affecting backwards compatibility of the workflow definition.
466468
* The attribute can have a string argument for the signal name. Otherwise the name is defaulted to the unqualified
467469
method name with `Async` trimmed off the end if it is present.
468470
* This attribute is not inherited and therefore must be explicitly set on any override.
@@ -495,7 +497,7 @@ Workflows can inherit from interfaces and base classes. Callers can use these in
495497
without the implementation present. This can be valuable in separating logic, but there are some details that should be
496498
noted.
497499

498-
`[Workflow]` and `[WorkflowRun]` attributes are never inherited and must be defined on item that is actually registered
500+
`[Workflow]` and `[WorkflowRun]` attributes are never inherited and must be defined on items that are actually registered
499501
with the worker. This means even if an interface or base class has these, they must also be present on the final
500502
implementing class. So if a base class has a full `[WorkflowRun]` implementation, the subclass must override that
501503
method, set `[WorkflowRun]` on the override, and then it can delegate to the base class. This explicit non-inheritance
@@ -727,7 +729,7 @@ with .NET tasks inside of workflows:
727729

728730
In order to help catch wrong scheduler use, by default the Temporal .NET SDK adds an event source listener for
729731
info-level task events. While this technically receives events from all uses of tasks in the process, we make sure to
730-
ignore anything that is not running in a workflow in a high performant way (basically one thread local check). For code
732+
ignore anything that is not running in a workflow in a highly performant way (basically one thread local check). For code
731733
that does run in a workflow and accidentally starts a task in another scheduler, an `InvalidWorkflowOperationException`
732734
will be thrown which "pauses" the workflow (fails the workflow task which continually retries until the code is fixed.).
733735
This is unfortunately a runtime-only check, but can help catch mistakes early. If this needs to be turned off for any
@@ -740,7 +742,7 @@ timers.
740742
##### Workflow .editorconfig
741743

742744
Since workflow code follows some different logic rules than regular C# code, there are some common analyzer rules out
743-
there that developers may want to disable. To ensure these are only disabled for workflows, current recommendation is to
745+
there that developers may want to disable. To ensure these are only disabled for workflows, the current recommendation is to
744746
use the `.workflow.cs` extension for files containing workflows.
745747

746748
Here are the rules to disable:
@@ -819,7 +821,7 @@ but only for one test at a time because time skipping is locked/unlocked at the
819821

820822
##### Automatic Time Skipping
821823

822-
Anytime a workflow result is waiting on, the time-skipping server automatically advances to the next event it can. To
824+
Anytime a workflow result is waited on, the time-skipping server automatically advances to the next event it can. To
823825
manually advance time before waiting on the result of the workflow, the `WorkflowEnvironment.DelayAsync` method can be
824826
used. If an activity is running, time-skipping is disabled.
825827

@@ -852,9 +854,9 @@ public async Task WaitADayWorkflow_SimpleRun_Succeeds()
852854
{
853855
await using var env = await WorkflowEnvironment.StartTimeSkippingAsync();
854856
using var worker = new TemporalWorker(
855-
env.Client,
856-
new TemporalWorkerOptions($"task-queue-{Guid.NewGuid()}").
857-
AddWorkflow<WaitADayWorkflow>());
857+
env.Client,
858+
new TemporalWorkerOptions($"task-queue-{Guid.NewGuid()}").
859+
AddWorkflow<WaitADayWorkflow>());
858860
await worker.ExecuteAsync(async () =>
859861
{
860862
var result = await env.Client.ExecuteWorkflowAsync(
@@ -972,7 +974,7 @@ using Temporalio.Worker;
972974
public static async Task ReplayFromJsonAsync(string historyJson)
973975
{
974976
var replayer = new WorkflowReplayer(
975-
new WorkflowReplayerOptions().AddWorkflow<MyWorkflow>());
977+
new WorkflowReplayerOptions().AddWorkflow<MyWorkflow>());
976978
await replayer.ReplayWorkflowAsync(WorkflowHistory.FromJson("my-workflow-id", historyJson));
977979
}
978980
```
@@ -991,7 +993,7 @@ using Temporalio.Worker;
991993
public static async Task CheckPastHistoriesAysnc(ITemporalClient client)
992994
{
993995
var replayer = new WorkflowReplayer(
994-
new WorkflowReplayerOptions().AddWorkflow<MyWorkflow>());
996+
new WorkflowReplayerOptions().AddWorkflow<MyWorkflow>());
995997
var listIter = client.ListWorkflowHistoriesAsync("WorkflowType = 'SayHello'");
996998
await foreach (var result in replayer.ReplayWorkflowsAsync(listIter))
997999
{
@@ -1049,7 +1051,7 @@ Notes about activity definitions:
10491051
* Long running activities should heartbeat to regularly to inform server the activity is still running.
10501052
* Heartbeats are throttled internally, so users can call this frequently without fear of calling too much.
10511053
* Activities must heartbeat to receive cancellation.
1052-
* Activities can be defined on static or instance methods. They can even be lambdas or local methods, but rarely is this
1054+
* Activities can be defined as static or instance methods. They can even be lambdas or local methods, but rarely is this
10531055
valuable since often an activity will be referenced by a workflow.
10541056
* Activities can be synchronous or asynchronous. If an activity returns a `Task`, that task is awaited on as part of the
10551057
activity.

0 commit comments

Comments
 (0)