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 thecreateMessage
API, creates aMessage
document and forks theCreatedMessageOrchestrator
durable 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 theMessage
document after the content of the message has been successfully storedCreateNotificationActivity
: creates aNotification
documentEmailNotificationActivity
: sends an email notification if neededWebhookNotificationActivity
: triggers a webhook call if neededNotificationStatusUpdaterActivity
: updates theNotification
document with the results of the email or webhook notifications.
GetMessage
: handles thegetMessage
API for servicesGetLimitedProfile
: handles thegetProfile
API for servicesGetSubscriptionsFeed
: handles thegetSubscriptionsFeedForDay
API 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 <[email protected]>",
"QueueStorageConnection": "<QUEUES_STORAGE_CONNECTION_STRING>",
"SUBSCRIPTIONS_FEED_TABLE": "SubscriptionsFeedByDay"
},
"ConnectionStrings": {}
}
yarn start
The server should reload automatically when the code changes.
To start itegration tests:
cd __integrations__
cp environments/env.base environments/.env
yarn start
docker exec integrations__-testagent_1 yarn test
To stop docker containers:
cd __integrations__
yarn stop