This repository contains demos for my talk: 'Persistence in Serverless Applications'.
The src folder contains an Azure Functions project (.NET 6 in-process) with the following HTTP triggered functions:
| Name | Binding | Description |
|---|---|---|
| StorePlayerWithStreamBlobOutput | Blob output | Using Stream |
| StorePlayerWithStringBlobOutput | Blob output | Using string |
| StorePlayerWithStringBlobOutputDynamic | Blob output | Using IBinder (dynamic binding) |
| GetPlayerWithStreamBlobInput | Blob input | Using Stream |
| GetPlayerWithStringBlobInputDynamic | Blob input | Using IBinder (dynamic binding) |
| StorePlayerReturnAttributeTableOutput | Table output | Using return attribute |
| StorePlayersWithCollectorTableOutput | Table output | Using IAsyncCollector<PlayerEntity> |
| GetPlayerByRegionAndIdTableInput | Table input | Using PlayerEntity |
| GetPlayersByRegionTableClient | Table input | Using TableClient |
| StorePlayerCosmosOutput | CosmosDB output | Using the Player |
| StorePlayerReturnAttributeCosmosOutput | CosmosDB output | Using return attribute |
| StorePlayersWithCollectorCosmosOutput | CosmosDB output | Using IAsyncCollector<Player> |
| GetPlayerByRegionAndIdCosmosInput | CosmosDB input | Using Player |
| GetPlayersByRegionDocumentClientCosmosInput | CosmosDB input | Using DocumentClient |
| UpdatePlayerScore | Durable Entity | Uses Durable Functions |
- .NET 6 SDK; the SDK and runtime to develop Azure Functions in C# .NET 6.
- VSCode; a powerful cross platform source editor.
- Azure Functions extension for VSCode; for creating and running Azure Functions locally (using the Azure Functions Core Tools).
- Azurite extension for VSCode; Storage emulator for blobs, tables and queues.
- Azure Databases extension for VSCode; To manage your cloud based CosmosDB from VSCode.
- Azure CosmosDB or the CosmosDB Emulator; a NoSQL data store.
- Azure Storage Explorer; Graphical user interface to manage and inspect blobs, tables, and queues, either in the cloud or locally emulated.
- A REST client, such as the REST Client extension for VSCode.
All VSCode extensions are automatically recommended to be installed when you open this folder in VSCode.
- Clone this repo.
- Open the folder in VSCode.
- Install the recommended extensions.
- Ensure that a CosmosDB instance is present in either the cloud or the emulator with these settings:
- Database:
gamedb - Collection:
players - PartitionKey:
region
- Database:
- Build the project to ensure that there are no errors:
- Via the build task:
CTRL/CMD+SHIFT+Bor - Via the terminal in the
src/ServerlessPersistencefolder:dotnet build
- Via the build task:
- Start Azurite services:
- Via the command palette:
CRTL/CMD+SHIFT+P->Azurite: Start
- Via the command palette:
- Run the Function App:
- Via the debug command:
F5or - Via the terminal in the
src/ServerlessPersistencefolder:func start.
- Via the debug command:
- Now use the http files located in
tstand a REST client to trigger the functions.
If you want to learn more about Azure Functions, have a look at Azure Functions University, a free and open source curriculum on GitHub and YouTube.
Found a bug or want to ask a question? Feel free to raise an issue or submit a pull request. Or you can reach out to me on Twitter.