Skip to main content
net10.0net8.0

Microsoft Orleans reminders provider for Azure Cosmos DB

Published
Jul 21, 2026
3mo ago
Total Downloads
272.5K
272,500

Install

dotnet add package Microsoft.Orleans.Reminders.Cosmos --version 10.2.2
ProductVersions
.NET
net10.0net8.0

README

Microsoft Orleans Reminders for Azure Cosmos DB

Introduction

Microsoft Orleans Reminders for Azure Cosmos DB provides persistence for Orleans reminders using Azure Cosmos DB. This allows your Orleans applications to schedule persistent reminders that will be triggered even after silo restarts or grain deactivation.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Reminders.Cosmos

Example - Configuring Azure Cosmos DB Reminders

using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure Azure Cosmos DB as reminder storage
            .UseCosmosDBReminders(options =>
            {
                options.AccountEndpoint = "https://YOUR_COSMOS_ENDPOINT";
                options.AccountKey = "YOUR_COSMOS_KEY";
                options.DB = "YOUR_DATABASE_NAME";
                options.CanCreateResources = true;
            });
    });

// Run the host
await builder.RunAsync();

Example - Using Reminders in a Grain

public interface IReminderGrain
{
    Task StartReminder(string reminderName);
    Task StopReminder();
}

public class ReminderGrain : Grain, IReminderGrain, IRemindable
{
    private string _reminderName = "MyReminder";

    public async Task StartReminder(string reminderName)
    {
        _reminderName = reminderName;
        
        // Register a persistent reminder
        await RegisterOrUpdateReminder(
            reminderName,
            TimeSpan.FromMinutes(2),  // Time to delay before the first tick (must be > 1 minute)
            TimeSpan.FromMinutes(5)); // Period of the reminder (must be > 1 minute)
    }

    public async Task StopReminder()
    {
        // Find and unregister the reminder
        var reminder = await GetReminder(_reminderName);
        if (reminder != null)
        {
            await UnregisterReminder(reminder);
        }
    }

    public Task ReceiveReminder(string reminderName, TickStatus status)
    {
        // This method is called when the reminder ticks
        Console.WriteLine($"Reminder {reminderName} triggered at {DateTime.UtcNow}. Status: {status}");
        return Task.CompletedTask;
    }
}

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

Changes from Previous Version

No structural changes between v10.2.2-rc.2 and v10.2.2.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.The published metadata declares 59 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.