How parameshg/orleans-prototype works
Based on your project’s file tree and README, the system is a distributed IoT prototype that leverages Microsoft Orleans to process events from emulated IoT devices. The overall purpose is to demonstrate how Orleans’ virtual actor model can be used to build a scalable, distributed server that receives, processes, and responds to events from various IoT devices.
Project Type and Purpose
• This is a distributed IoT system prototype built using Microsoft Orleans. Its main goal is to handle events received from IoT devices, process these using device type–specific logic (e.g., Prime, Factorial, Mean, Variance, Standard Deviation), and send results back.
• The system spans multiple project types: a REST-based API (IoT.Api), a Windows Forms–based IoT Devices client, and a Windows Forms host (IoT.Server.Host) that runs the Orleans runtime with the core business logic encapsulated in IoT.Server and IoT.Server.Interfaces.
• It includes shared components (IoT.Shared) and uses SQL Server (with provided scripts) for persistence, clustering, and reminders.
Main Components
a. Client Layer (IoT.Devices)
• Represented by a Windows Forms UI that emulates IoT devices generating events.
• Details about its Redux-based local state management (Redux folders and actions/reducers).
b. API Gateway (IoT.Api)
• A REST API that acts as the entry point for device-generated events.
• Depicts the stateless API which accepts events, serves as an Orleans client, and forwards requests to the Orleans-hosted grains.
c. Orleans Cluster Host (IoT.Server.Host)
• Hosts the Orleans runtime and manages the lifecycle of grains.
• Role in activating, deactivating, and handling grain state as events are processed.
d. Business Logic/Grains (IoT.Server, IoT.Server.Interfaces, IoT.Shared)
• Core business logic encapsulated in grains (for PrimeTester, FactorialFinder, Statistics, etc.).
• IoT.Server.Interfaces exposes service interfaces for grain communication.
• IoT.Shared contains shared entities and enumerations (like the Device entity and Device status/type).
e. Persistence/Storage (IoT.Storage)
• An external Microsoft SQL Server where grain states, clustering information, and reminders are stored.
• That several SQL scripts create the necessary tables (SQLServer-Main.sql, SQLServer-Persistence.sql, etc.).
Relationships and Interactions
• From IoT.Devices (client) to IoT.Api: Devices send events via REST calls.
• From IoT.Api to Orleans Cluster Host (IoT.Server.Host): The API acts as an Orleans client, forwarding device events.
• Within the Orleans Cluster Host, indicate how the Orleans runtime receives events and instantiates/activates the appropriate grain (business logic in IoT.Server).
Architectural Patterns and Design Principles
• Use of the Virtual Actor model:
• Annotations or labels for “Grain Activation”, “Managed Grain Lifecycle”, and “State Persistence”.
• Separation between client, API, Orleans host, and persistence.
• That the system is built for scalability and resilience using Orleans’ automatic grain management.