Book Image

Distributed .NET with Microsoft Orleans

By : Bhupesh Guptha Muthiyalu, Suneel Kumar Kunani
Book Image

Distributed .NET with Microsoft Orleans

By: Bhupesh Guptha Muthiyalu, Suneel Kumar Kunani

Overview of this book

Building distributed applications in this modern era can be a tedious task as customers expect high availability, high performance, and improved resilience. With the help of this book, you'll discover how you can harness the power of Microsoft Orleans to build impressive distributed applications. Distributed .NET with Microsoft Orleans will demonstrate how to leverage Orleans to build highly scalable distributed applications step by step in the least possible time and with minimum effort. You'll explore some of the key concepts of Microsoft Orleans, including the Orleans programming model, runtime, virtual actors, hosting, and deployment. As you advance, you'll become well-versed with important Orleans assets such as grains, silos, timers, and persistence. Throughout the book, you'll create a distributed application by adding key components to the application as you progress through each chapter and explore them in detail. By the end of this book, you'll have developed the confidence and skills required to build distributed applications using Microsoft Orleans and deploy them in Microsoft Azure.
Table of Contents (17 chapters)
1
Section 1 - Distributed Applications Architecture
4
Section 2 - Working with Microsoft Orleans
10
Section 3 - Building Patterns in Orleans
13
Section 4 - Hosting and Deploying Orleans Applications to Azure

Grains with multiple states

An Orleans grain can have more than one state and they can be from different state providers. The HotelGrain class we implemented has the checkedInGuests state and it is persisted to Azure Cosmos DB. The main business of Distel is providing hospitality at all the locations of the seven wonders of the world. Consider that we may have a partnership with others to provide services such as transport for our guests. To manage this, we need to have the HotelGrain state manage the partner relationships. Though this should be part of the HotelGrain state, we may not want to club this with the checkedInGuests state as they both represent two different entities. Since the two states are separate concerns from each other, we will track them separately, with two different state providers. In this section, we will learn about having multiple states for the grain with different providers.

Follow the steps outlined here to add a new state:

  1. Let's start by...