Skip to content

Latest commit

 

History

History
54 lines (35 loc) · 3.33 KB

File metadata and controls

54 lines (35 loc) · 3.33 KB

Challenge 5 - Dapr SMTP Output binding

< Previous Challenge - Home - Next Challenge >

Introduction

In this challenge, you're going to use a Dapr output binding in the FineCollectionService to send an email.

Description

Dapr offers a bindings building block to easily interface with external systems. Bindings are divided into input bindings and output bindings. Input bindings trigger your services by picking up events from external systems. Output bindings are an easy way to invoke functionality of an external system. Both input and output bindings work without the developer having to learn the API or SDK of the external system. You only need to know the Dapr bindings API. See below for a diagram of how output bindings work:

For this hands-on challenge, you will add an output binding leveraging the Dapr binding building block. In the next challenge, you will implement a Dapr input binding. For detailed information, read the introduction to this building block in the Dapr documentation and the bindings chapter in the Dapr for .NET developers guidance eBook.

You will need to modify the services to use the Dapr SMTP output bindings.

  • Start up a development SMTP server that runs in a Docker container.
  • Modify the FineCollectionService (CollectionController class) so that it uses the Dapr SMTP output binding to send an email.
  • Create a Dapr configuration file for specifying the Dapr SMTP output binding component.
  • Restart all services & run the Simulation application.
  • After you get the application running locally, modify it to use an Azure Logic App to send the same email instead of the local development SMTP server.

Success Criteria

This challenge targets the operation labeled as number 4 in the end-state setup:

Local

Azure

  • Validate that your local development SMTP server is running.
  • Validate that the FineCollectionService has been modified so that it uses the Dapr sidecar to send out email via an output binding.
  • Validate that you receive speeding violations in your email when the simulation app runs.
  • After modifying your Dapr code to use an Azure Logic App, verify you still receive speeding violation emails.

Tips

  • Use MailDev for the development SMTP server.
    docker run -d -p 4000:80 -p 4025:25 --name dtc-maildev maildev/maildev:latest
  • You can observe the MailDev server locally by navigating to http://localhost:4000.
  • Use an Azure Logic App to send out emails when deploying to Azure.

Learning Resources