Add clarifying comments

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
This commit is contained in:
Marc Duiker 2025-04-22 11:23:27 +02:00
parent 4ccd420eb8
commit 4fdb24db5e
No known key found for this signature in database
GPG Key ID: 6A36EA7754473DD7
2 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@ builder.Services.AddDaprClient();
var app = builder.Build();
app.UseCloudEvents();
/// This endpoint is called by the CheckShippingDestination activity in the WorkflowApp.
app.MapPost("/checkDestination", (
Order order) =>
{
@ -14,6 +15,9 @@ app.MapPost("/checkDestination", (
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 (
Order order,
DaprClient daprClient) =>

View File

@ -27,6 +27,7 @@ app.MapPost("/start", async (
{
// 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();
var instanceId = await workflowClient.ScheduleNewWorkflowAsync(
@ -37,6 +38,9 @@ app.MapPost("/start", async (
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 (
ShipmentRegistrationStatus status,
DaprWorkflowClient workflowClient) =>
@ -51,6 +55,7 @@ app.MapPost("/shipmentRegistered", async (
return Results.Accepted();
});
// This endpoint is a manual helper method to restock the inventory.
app.MapPost("/inventory/restock", async (
ProductInventory productInventory,
DaprClient daprClient
@ -64,6 +69,7 @@ app.MapPost("/inventory/restock", async (
return Results.Accepted();
});
// This endpoint is a manual helper method to check the inventory.
app.MapGet("/inventory/{productId}", async (
string productId,
DaprClient daprClient