mirror of https://github.com/dapr/quickstarts.git
Updates for v1.11
Signed-off-by: Chris Gillum <cgillum@microsoft.com>
This commit is contained in:
parent
205a59a457
commit
5a5a3e9157
|
|
@ -32,10 +32,6 @@ host.Start();
|
|||
|
||||
using var daprClient = new DaprClientBuilder().Build();
|
||||
|
||||
// NOTE: WorkflowEngineClient will be replaced with a richer version of DaprClient
|
||||
// in a subsequent SDK release. This is a temporary workaround.
|
||||
WorkflowEngineClient workflowClient = host.Services.GetRequiredService<WorkflowEngineClient>();
|
||||
|
||||
// Populate the store with items
|
||||
RestockInventory();
|
||||
|
||||
|
|
@ -50,26 +46,23 @@ OrderPayload orderInfo = new OrderPayload(itemToPurchase, 15000, ammountToPurcha
|
|||
// Start the workflow
|
||||
Console.WriteLine("Starting workflow {0} purchasing {1} {2}", orderId, ammountToPurchase, itemToPurchase);
|
||||
|
||||
await workflowClient.ScheduleNewWorkflowAsync(
|
||||
name: nameof(OrderProcessingWorkflow),
|
||||
instanceId: orderId,
|
||||
input: orderInfo);
|
||||
await daprClient.StartWorkflowAsync(
|
||||
workflowComponent: DaprWorkflowComponent,
|
||||
workflowName: nameof(OrderProcessingWorkflow),
|
||||
input: orderInfo,
|
||||
instanceId: orderId);
|
||||
|
||||
// Wait a second to allow workflow to start
|
||||
await Task.Delay(TimeSpan.FromSeconds(1));
|
||||
|
||||
WorkflowState state = await workflowClient.GetWorkflowStateAsync(
|
||||
// Wait for the workflow to start and confirm the input
|
||||
GetWorkflowResponse state = await daprClient.WaitForWorkflowStartAsync(
|
||||
instanceId: orderId,
|
||||
getInputsAndOutputs: true);
|
||||
workflowComponent: DaprWorkflowComponent);
|
||||
|
||||
Console.WriteLine("Your workflow has started. Here is the status of the workflow: {0}", state.RuntimeStatus);
|
||||
while (!state.IsWorkflowCompleted)
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromSeconds(5));
|
||||
state = await workflowClient.GetWorkflowStateAsync(
|
||||
instanceId: orderId,
|
||||
getInputsAndOutputs: true);
|
||||
}
|
||||
|
||||
// Wait for the workflow to complete
|
||||
state = await daprClient.WaitForWorkflowCompletionAsync(
|
||||
instanceId: orderId,
|
||||
workflowComponent: DaprWorkflowComponent);
|
||||
|
||||
Console.WriteLine("Workflow Status: {0}", state.RuntimeStatus);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapr.AspNetCore" Version="1.10.0-rc02" />
|
||||
<PackageReference Include="Dapr.Workflow" Version="1.10.0-rc02" />
|
||||
<PackageReference Include="Dapr.AspNetCore" Version="1.11.*" />
|
||||
<PackageReference Include="Dapr.Workflow" Version="1.11.*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue