Skip to content

Exercise Durable Functions - Order

Exercise Durable Functions - Order Processing

Build the following application using Azure Durable Functions:

DurableFunctionsExerciseOrderWorkflow.excalidraw.svg

Software Parts

Place Order

Customers can place an order using a HTTP Triggered Function endpoint. This should be a post request containing the following information:

  • Customer name and address
  • Customer email
  • List of ordered items (item name and quantity)

Process Order

The individual steps of the order should be processed by an Orchestrator Function. The steps are:

1. Get Item Information

Using the information in in the order message from the customer, we find the prices for each of the order items. You can generate a random number for each of the items. Calculate the total amount per order line (item * quantity) and the total amount for the complete order.

2. Send Confirmation Mail

Using the information from the step Get Item Information we send out an E-Mail to the customer, listing all the ordered items, together with the price per order line and total.

3. Package Items

In this step we package the items listed in the order. It might be the case, that one order will be split up into multiple shipments. Randomly split the order items into different shipments and return the information which items will be in which shipment.

4. Ship Items

Using the information from step Package Items, we have to ship the partial shipments. For each of the shipments wait for an external event from the carrier, that the shipment has been fulfilled.

5. Send Order Executed Mail

After all partial shipments have reached the customer, send out a final E-Mail informing them, that the order has been completed.

Additional requirements

We want to track the following information:

  • Time to complete an order, starting when we received the order until the order has been completed.
  • Time for each individual shipment.
  • Value for each shipment (total price for all the items within one shipment).
  • Number of items for each shipment

This tracking information should be persisted in an Azure Table Storage, so it can be used for further analysis later.

Hints

You can send out E-Mails any way you want. One easy way is to use services like Sendgrid or Brevo where you can send up to 100-300 mails per day for free. There are also ready-to-use NuGet packages for this service.