Starting workflows
IPgWorkflowClient is how your application code talks to PgWorkflows: start a run and
await its result, or fire-and-track with a handle.
Execute and wait
Section titled “Execute and wait”When you want the result inline:
var result = await workflows.ExecuteAsync<GreetingWorkflow, GreetingInput, string>( new GreetingInput("Postgres", 42));Start and track
Section titled “Start and track”When the workflow is long-running, start it and keep a handle:
var handle = await workflows.StartAsync<TrialOnboardingWorkflow, SignupInput, string>();
Console.WriteLine(handle.WorkflowRunId);
var result = await handle.GetResultAsync();Idempotency keys
Section titled “Idempotency keys”Pass an idempotency key so a retried producer doesn’t start the same workflow twice:
var handle = await workflows.StartAsync<TrialOnboardingWorkflow, SignupInput, string>( idempotencyKey: $"signup:{signupId}");