项目作者: alexlave100

项目描述 :
Azure functions mail order
高级语言: C#
项目地址: git://github.com/alexlave100/azfuncs---pipeline.git
创建时间: 2018-12-18T12:00:01Z
项目社区:https://github.com/alexlave100/azfuncs---pipeline

开源协议:

下载


Azure serverless functions

Example of common bindings and their use cases when developing Azure functions from VS17.

The program will execute an HTTP triggered function (WebHook.cs) when a POST request is made and add information into a queue and a table storage. Another azfunc (GenerateLicenseFile.cs) will be triggered when a new item is added to the queue. This queue item will be added to blob storage. Whenever a new item is added to the blob storage, a blob triggered function (EmailLicenseFile.cs) will execute. This function will retrieve the desired row from table storage for the email address of the sender and receiver of the request, create a new Email object (SendGridMessage) and send it, along with some additional information about the send data and a message, to the receiver email address.

POST request:

The POST request should have the same structure as the ‘Order’ class in WebHook.cs.

Example:

  1. {
  2. "OrderId": "1",
  3. "ProductId": "50",
  4. "ToEmail": "<YourOwnEmailIfYouWantToEnsureItworks>",
  5. "FromEmail": "<AnyValidEmailReally>",
  6. "Message": "Enter your email message here",
  7. "Price": "1000"
  8. }

For the SendGrid implementation, don’t forget to create a SendGrid Api Key and update the application settings in the Azure portal.

If running the solution locally:

The local.settings.json is .gitignored and must also be added and configured. The ‘AzureWebJobsStorage’ key value must be set to ‘true’ and the ‘AzureWebJobsSendGridApiKey’ must contain a valid Api key.

Example:

  1. {
  2. "IsEncrypted": false,
  3. "Values": {
  4. "AzureWebJobsSendGridApiKey": <ApiKey>,
  5. "AzureWebJobsStorage": "UseDevelopmentStorage=true",
  6. "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  7. },
  8. "ConnectionStrings": {}
  9. }