Orleans sample projects

Hello, World!

Sample code for the Hello World Orleans app.

A Hello, World! application that demonstrates how to create and use your first grains.

Hello World demonstrates

  • How to get started with Orleans
  • How to define and implement grain interface
  • How to get a reference to a grain and call a grain

Shopping Cart

Screen capture from the Shopping Cart Orleans sample app.

A canonical shopping cart sample application, built using Microsoft Orleans. This app shows the following features:

  • Shopping cart: A simple shopping cart application that uses Orleans for its cross-platform framework support, and its scalable distributed applications capabilities.

    • Inventory management: Edit and/or create product inventory.
    • Shop inventory: Explore purchasable products and add them to your cart.
    • Cart: View a summary of all the items in your cart, and manage these items; either removing or changing the quantity of each item.

Shopping cart demonstrates

  • How to create a distributed shopping cart experience
  • How to manage grain persistence as it relates to live inventory updates
  • How to expose user-specific items that span multiple clients

Adventure

Cover art for the Adventure Orleans app.

Before there were graphical user interfaces, before the era of game consoles and massive-multiplayer games, there were VT100 terminals and there was Colossal Cave Adventure, Zork, and Microsoft Adventure. Possibly bland by today's standards, back then it was a magical world of monsters, chirping birds, and things you could pick up. It's the inspiration for this sample.

Adventure demonstrates

  • How to structure an application (in this case, a game) using grains
  • How to connect an external client to an Orleans cluster (ClientBuilder)

Chirper

Sample code for the Chirper Orleans app.

A social network pub/sub system, with short text messages being sent between users. Publishers send out short "Chirp" messages (not to be confused with "Tweets", for various legal reasons) to any other users that are following them.

Chirper demonstrates

  • How to build a simplified social media / social network application using Orleans
  • How to store state within a grain using grain persistence (IPersistentState<T>)
  • Grains that implement multiple grain interfaces
  • Reentrant grains, which allow for multiple grain calls to be executed concurrently, in a single-threaded, interleaving fashion
  • Using a grain observer (IGrainObserver) to receive push notifications from grains

GPS Tracker

Sample code for the GPS Orleans app.

A service for tracking GPS-equipped IoT IoT devices on a map. Device locations are updated in near-real-time using SignalR and hence this sample demonstrates one approach to integrating Orleans with SignalR. The device updates originate from a device gateway, which is implemented using a separate process that connects to the main service and simulates several devices moving in a pseudorandom fashion around an area of San Francisco.

GPS Tracker demonstrates

  • How to use Orleans to build an Internet of Things application
  • How Orleans can be co-hosted and integrated with ASP.NET Core SignalR
  • How to broadcast real-time updates from a grain to a set of clients using Orleans and SignalR

HanBaoBao

HanBaoBao - Orleans sample application screen capture.

An English-Mandarin dictionary Web application demonstrating deployment to Kubernetes, fan-out grain calls, and request throttling.

HanBaoBao demonstrates

  • How to build a realistic application using Orleans
  • How to deploy an Orleans-based application to Kubernetes
  • How to integrate Orleans with ASP.NET Core and a Single-page Application JavaScript framework (Vue.js)
  • How to implement leaky-bucket request throttling
  • How to load and query data from a database
  • How to cache results lazily and temporarily
  • How to fan out requests to many grains and collect the results

Presence Service

Output from the Presence Service Orleans app.

A gaming presence service, similar to one of the Orleans-based services built for Halo. A presence service tracks players and game sessions in near-real-time.

Presence Service demonstrates

  • A simplified version of a real-world use of Orleans
  • Using a grain observer (IGrainObserver) to receive push notifications from grains

Tic Tac Toe

Logo from the Tic Tac Toe Orleans sample app.

A Web-based Tic-tac-toe game using ASP.NET MVC, JavaScript, and Orleans.

Tic Tac Toe demonstrates

  • How to build an online game using Orleans
  • How to build a basic game lobby system
  • How to access Orleans grains from an ASP.NET Core MVC application

Voting

Screen capture from Voting Orleans sample app.

A Web application for voting on a set of choices. This sample demonstrates deployment to Kubernetes. The application uses .NET generic host to co-host ASP.NET Core and Orleans as well as the Orleans Dashboard together in the same process.

The Orleans dashboard running as part of the Voting sample app.

Voting demonstrates

  • How to deploy an Orleans-based application to Kubernetes
  • How to configure the Orleans Dashboard

Chat Room

Sample output from the running Chat Room sample Orleans app.

A terminal-based chat application built using Orleans Streams.

Chat Room demonstrates

Bank Account

Output from the running Bank Account client sample Orleans app.

Simulates bank accounts, using ACID transactions to transfer random amounts between a set of accounts.

Bank Account demonstrates

  • How to use Orleans Transactions to safely perform operations involving multiple stateful grains with ACID guarantees and serializable isolation.

Blazor Server and Blazor WebAssembly

Blazor Orleans sample app screen capture

These two Blazor samples are based on the Blazor introductory tutorials, adapted for use with Orleans. The Blazor WebAssembly sample uses the Blazor WebAssembly hosting model. The Blazor Server sample uses the Blazor Server hosting model. They include an interactive counter, a TODO list, and a Weather service.

Blazor sample apps demonstrate

  • How to integrate ASP.NET Core Blazor Server with Orleans
  • How to integrate ASP.NET Core Blazor WebAssembly (WASM) with Orleans

Stocks

Output from the running Stocks client sample Orleans app.

A stock price application that fetches prices from a remote service using an HTTP call and caches prices temporarily in a grain. A BackgroundService periodically polls for updated stock prices from various StockGrain grains that correspond to a set of stock symbols.

Stocks sample app demonstrates

  • How to use Orleans from within a BackgroundService.
  • How to use timers within a grain.
  • How to make external service calls using .NET's HttpClient and cache the results within a grain.

Transport Layer Security

Output from the running TLS sample Orleans app.

A Hello, World! application configured to use mutual Transport Layer Security to secure network communication between every server.

Transport Layer Security demonstrates

  • How to configure mutual-TLS (mTLS) authentication for Orleans

Visual Basic Hello World

A Hello, World! application using Visual Basic.

Visual Basic Hello World demonstrates

  • How to develop Orleans-based applications using Visual Basic

F# Hello World

A Hello, World! application using F#.

F# Hello World demonstrates

  • How to develop Orleans-based applications using F#

Streaming: Pub/Sub Streams over Azure Event Hubs

An application using Orleans Streams with Azure Event Hubs as the provider and implicit subscribers.

Pub/Sub Streams demonstrates

  • How to use Orleans Streams
  • How to use the [ImplicitStreamSubscription(namespace)] attribute to implicitly subscribe a grain to the stream with the corresponding ID
  • How to configure Orleans Streams for use with Azure Event Hubs

Streaming: Custom Data Adapter

An application using Orleans Streams with a non-Orleans publisher pushing to a stream that a grain consumes via a custom data adapter that tells Orleans how to interpret stream messages.

Custom Data Adapter demonstrates

  • How to use Orleans Streams
  • How to use the [ImplicitStreamSubscription(namespace)] attribute to implicitly subscribe a grain to the stream with the corresponding ID
  • How to configure Orleans Streams for use with Azure Event Hubs
  • How to consume stream messages published by non-Orleans publishers by providing a custom EventHubDataAdapter implementation (a custom data adapter)