Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Advanced Serverless Architectures with Microsoft Azure

You're reading from   Advanced Serverless Architectures with Microsoft Azure Design complex serverless systems quickly with the scalability and benefits of Azure

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781788479127
Length 278 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Daniel Bass Daniel Bass
Author Profile Icon Daniel Bass
Daniel Bass
Arrow right icon
View More author details
Toc

Chapter 2: Microservices and Serverless Scaling Patterns


Activity 2: Implementing Asynchronous Microblog Submission and Caching

  1. Create a new C# Azure Functions project inside a folder called MicroBlogPostFunctions and create a model called MicroBlogPost that accepts a post with a username (email address), title, and content:

    Figure 2.50: MicroBlogPost class

  2. Create a HTTP-triggered function named PostMicroBlogPost that submits these posts to an Azure Storage Queue named MicroBlogPosts:

    Figure 2.51: Function that saves MicroBlogPosts to a queue

  3. Create a function named DequeMicroBlogPosts that takes the posts from the queue and inserts them into a Cosmos DB named MicroBlogSite:

    Figure 2.52: Function that dequeues objects and saves them into a Cosmos DB

  4. Create a function called GetMicroBlogPosts that retrieves posts from the Cosmos DB in a list and uses the expires header to instruct end users to cache the response:

    Figure 2.53: Function that retrieves all MicroBlogPosts and instructs clients to cache them

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime