mirror of https://github.com/dapr/quickstarts.git
Add clarifying comments
Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
This commit is contained in:
parent
4ccd420eb8
commit
4fdb24db5e
|
@ -6,6 +6,7 @@ builder.Services.AddDaprClient();
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
app.UseCloudEvents();
|
app.UseCloudEvents();
|
||||||
|
|
||||||
|
/// This endpoint is called by the CheckShippingDestination activity in the WorkflowApp.
|
||||||
app.MapPost("/checkDestination", (
|
app.MapPost("/checkDestination", (
|
||||||
Order order) =>
|
Order order) =>
|
||||||
{
|
{
|
||||||
|
@ -14,6 +15,9 @@ app.MapPost("/checkDestination", (
|
||||||
return Results.Ok(result);
|
return Results.Ok(result);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This endpoint handles messages that are published to the shipment-registration-events topic.
|
||||||
|
// The RegisterShipment activity in the WorkflowApp is publishing to this topic.
|
||||||
|
// This method is publishing a message to the shipment-registration-confirmed-events topic.
|
||||||
app.MapPost("/registerShipment", async (
|
app.MapPost("/registerShipment", async (
|
||||||
Order order,
|
Order order,
|
||||||
DaprClient daprClient) =>
|
DaprClient daprClient) =>
|
||||||
|
|
|
@ -27,6 +27,7 @@ app.MapPost("/start", async (
|
||||||
{
|
{
|
||||||
|
|
||||||
// This is to ensure to have enough inventory for the order.
|
// This is to ensure to have enough inventory for the order.
|
||||||
|
// So the manual restock endpoint is not needed in this sample.
|
||||||
await inventory.CreateDefaultInventoryAsync();
|
await inventory.CreateDefaultInventoryAsync();
|
||||||
|
|
||||||
var instanceId = await workflowClient.ScheduleNewWorkflowAsync(
|
var instanceId = await workflowClient.ScheduleNewWorkflowAsync(
|
||||||
|
@ -37,6 +38,9 @@ app.MapPost("/start", async (
|
||||||
return Results.Accepted(instanceId);
|
return Results.Accepted(instanceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This endpoint handles messages that are published to the shipment-registration-confirmed-events topic.
|
||||||
|
// It uses the workflow management API to raise an event to the workflow instance to indicate that the
|
||||||
|
// shipment has been registered by the ShippingApp.
|
||||||
app.MapPost("/shipmentRegistered", async (
|
app.MapPost("/shipmentRegistered", async (
|
||||||
ShipmentRegistrationStatus status,
|
ShipmentRegistrationStatus status,
|
||||||
DaprWorkflowClient workflowClient) =>
|
DaprWorkflowClient workflowClient) =>
|
||||||
|
@ -51,6 +55,7 @@ app.MapPost("/shipmentRegistered", async (
|
||||||
return Results.Accepted();
|
return Results.Accepted();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This endpoint is a manual helper method to restock the inventory.
|
||||||
app.MapPost("/inventory/restock", async (
|
app.MapPost("/inventory/restock", async (
|
||||||
ProductInventory productInventory,
|
ProductInventory productInventory,
|
||||||
DaprClient daprClient
|
DaprClient daprClient
|
||||||
|
@ -64,6 +69,7 @@ app.MapPost("/inventory/restock", async (
|
||||||
return Results.Accepted();
|
return Results.Accepted();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// This endpoint is a manual helper method to check the inventory.
|
||||||
app.MapGet("/inventory/{productId}", async (
|
app.MapGet("/inventory/{productId}", async (
|
||||||
string productId,
|
string productId,
|
||||||
DaprClient daprClient
|
DaprClient daprClient
|
||||||
|
|
Loading…
Reference in New Issue