Welcome to another dive into our new book, Hands-On Microservices with C# 8 and .NET Core 3. Here are our previous posts:
In this series of blog posts, Packt is giving away 10 eBooks for our new book, Hands-On Microservices with C# 8 and .NET Core 3:
Patterns are a series of architecture-like best practices for developers to solve common problems found in building cloud applications. By following a series of patterns, developers can build web apps that are secure, reliable, performant, and scalable.
Did you know that this is the third edition of the book? That's right! This is Gaurav's third round on the topic. Here are some of the Azure Developer Community team members who were involved with the books:
So, while releasing the other versions of the book, there was a lot of feedback, where readers were asking Gaurav to demonstrate more of these development architectural patterns. Thus the Hands-On Microservices book is chock-full of them!
This blog post (the one you're oh so reading) takes a natural transition after reading Andreas' summary of the book, API Patterns and Technologies.
Let's briefly take a taste test of two architectural scenarios...
The API Gateway is a backend service that we'll look at. It's used in many patterns (Gateway Routing, Aggregation, Offloading, etc.), but we'll use it inside a pattern called the Backends for Frontends (BFF) pattern. I think we engineers secretly wanted to create a software acronym for BFF for years, simply so that we can call something our BFF (best friends forever) whilst snickering. BFF was popularized by Sam Newman and coined by Phil Calcado.
Basically, you create different/separate API backend services, each coupled to its specific UI client, such as a mobile app or desktop app. This allows you to tune up your performance for the specific needs of your client, without affecting the experience of the other UI client.
Let's look at that basic architecture:
On the left, we have a browser UI that is coupled with the ASP.NET Web UI, and then down into our API Gateway. On the right, the mobile app is coupled together with a separate API Gateway. These API Gateways act as our BFFs. In the book, we explain how you would use Azure API Management as your API Gateway.
An API Gateway is simply a reverse proxy that's used by apps to talk to microservices. For example, it will accept API calls and route them to your backend/downstream services. The book further unpacks the architecture and gives you an example.
Keep digging to find out if the BFF pattern and an API Gateway is the right solution for your architecture! You can browse a sample of the book on Amazon.
Let's move on for our second taste test! I guess this is the software equivalent of wine tasting...
The Event-Driven Pattern
As you can see in the above diagram, we publish an event whenever a service updates its data. We've got a retail scenario here.
So a Customer Service performs a check for the user. Let's say the Customer Service checks for the user's login details. It publishes an event that verifies the customer. Then the Checkout Service receives the event, processes the payment, and makes the order official. It publishes an event that's received by the Order Service, telling it that it's time to make the order. Order Service updates the quantity and sends Product Service an event to send out the product.
The Event Manager kind of acts like the mob boss, taking the favors and exchanging out new favors. Okay, it's nothing like that.
You can read more about the Event-Driven pattern and the popular Event-Sourcing pattern in the book. You can browse a sample of the book on Amazon.
And so ends our Azure development taste test! You know, it's a taste test...
Oh, by the way, did you know you can win the eBook?
And you can read the rest of this series here (this is Part 4 of the series):
Remember to keep your distance, your hands clean, your feet on the ground, and your head in the Cloud,
- Ninja Ed
* Please take a few minutes to complete our survey. Please ensure you are authorized to provide this information and not violating any company policies. Your responses will be kept confidential with restricted access. For more information, see the Microsoft Privacy Statement. If you have questions about this survey, please contact TechCommunity@microsoft.com.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.