Skip to content

Repository with demos for my talk 'Persistence in Serverless Applications'

License

Notifications You must be signed in to change notification settings

marcduiker/demos-serverless-persistence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persistance in Serverless Applications

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

Running locally

Prerequisites

All VSCode extensions are automatically recommended to be installed when you open this folder in VSCode.

Running the Function App

  1. Clone this repo.
  2. Open the folder in VSCode.
  3. Install the recommended extensions.
  4. Ensure that a CosmosDB instance is present in either the cloud or the emulator with these settings:
    • Database: gamedb
    • Collection: players
    • PartitionKey: region
  5. Build the project to ensure that there are no errors:
    • Via the build task: CTRL/CMD+SHIFT+B or
    • Via the terminal in the src/ServerlessPersistence folder: dotnet build
  6. Start Azurite services:
    • Via the command palette: CRTL/CMD+SHIFT+P -> Azurite: Start
  7. Run the Function App:
    • Via the debug command: F5 or
    • Via the terminal in the src/ServerlessPersistence folder: func start.
  8. Now use the http files located in tst and a REST client to trigger the functions.

More info

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.

About

Repository with demos for my talk 'Persistence in Serverless Applications'

Topics

Resources

License

Stars

Watchers

Forks

Languages