This project implements the APIs called by the 3rd party services. The implementation is based on the Azure Functions v2 runtime.
The project is structured as follows:
CreateMessage: handles thecreateMessageAPI, creates aMessagedocument and forks theCreatedMessageOrchestratordurable function:CreatedMessageOrchestrator: handles all the asynchronous activities involving the creation of a message, it calls the following activities:StoreMessageContentActivity: stores the content of the message in a blobMessageStatusUpdaterActivity: upsates the status of theMessagedocument after the content of the message has been successfully storedCreateNotificationActivity: creates aNotificationdocumentEmailNotificationActivity: sends an email notification if neededWebhookNotificationActivity: triggers a webhook call if neededNotificationStatusUpdaterActivity: updates theNotificationdocument with the results of the email or webhook notifications.
GetMessage: handles thegetMessageAPI for servicesGetLimitedProfile: handles thegetProfileAPI for servicesGetSubscriptionsFeed: handles thegetSubscriptionsFeedForDayAPI for services
Install the Azure Functions Core Tools.
Install the dependencies:
$ yarn install
Create a file local.settings.json in your cloned repo, with the
following contents:
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "node",
"WEBSITE_NODE_DEFAULT_VERSION": "10.14.1",
"AzureWebJobsStorage": "<JOBS_STORAGE_CONNECTION_STRING>",
"APPINSIGHTS_INSTRUMENTATIONKEY": "<APPINSIGHTS_KEY>",
"MESSAGE_CONTAINER_NAME": "message-content",
"COSMOSDB_NAME": "<COSMOSDB_DB_NAME>",
"COSMOSDB_KEY": "<COSMOSDB_KEY>",
"COSMOSDB_URI": "<COSMOSDB_URI>",
"WEBHOOK_CHANNEL_URL": "<WEBHOOK_URL>",
"MAILUP_USERNAME": "<MAILUP_USERNAME>",
"MAILUP_SECRET": "<MAILUP_PASSWORD>",
"MAIL_FROM_DEFAULT": "IO - l’app dei servizi pubblici <no-reply@io.italia.it>",
"QueueStorageConnection": "<QUEUES_STORAGE_CONNECTION_STRING>",
"SUBSCRIPTIONS_FEED_TABLE": "SubscriptionsFeedByDay"
},
"ConnectionStrings": {}
}$ yarn start
The server should reload automatically when the code changes.