mirror of https://github.com/dapr/quickstarts.git
Merge pull request #851 from paulyuk/patch/workflow-dotnet
Patch/workflow -- fixes #831
This commit is contained in:
commit
b199c5631a
|
|
@ -33,14 +33,18 @@ host.Start();
|
|||
|
||||
using var daprClient = new DaprClientBuilder().Build();
|
||||
|
||||
// Populate the store with items
|
||||
RestockInventory();
|
||||
// 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>();
|
||||
|
||||
// Generate a unique ID for the workflow
|
||||
string orderId = Guid.NewGuid().ToString()[..8];
|
||||
string itemToPurchase = "Cars";
|
||||
int ammountToPurchase = 10;
|
||||
|
||||
// Populate the store with items
|
||||
RestockInventory(itemToPurchase);
|
||||
|
||||
// Construct the order
|
||||
OrderPayload orderInfo = new OrderPayload(itemToPurchase, 15000, ammountToPurchase);
|
||||
|
||||
|
|
@ -67,7 +71,7 @@ state = await daprClient.WaitForWorkflowCompletionAsync(
|
|||
|
||||
Console.WriteLine("Workflow Status: {0}", state.RuntimeStatus);
|
||||
|
||||
void RestockInventory()
|
||||
void RestockInventory(string itemToPurchase)
|
||||
{
|
||||
daprClient.SaveStateAsync<OrderPayload>(StoreName, itemToPurchase, new OrderPayload(Name: itemToPurchase, TotalCost: 15000, Quantity: 100));
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in New Issue