Skip to main content
net10.0net8.0.NETStandard2.1

MessagePack integration for Orleans.Serialization

Published
May 13, 2026
5mo ago
Total Downloads
52.4K
52,415

Install

dotnet add package Microsoft.Orleans.Serialization.MessagePack --version 10.1.1-preview.1
ProductVersions
.NET
net10.0net8.0
.NET Standard
netstandard2.1

README

Microsoft Orleans Serialization for MessagePack

Introduction

Microsoft Orleans Serialization for MessagePack provides MessagePack serialization support for Microsoft Orleans using the MessagePack format. This high-performance binary serialization format is ideal for scenarios requiring efficient serialization and deserialization.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Serialization.MessagePack

Example - Configuring MessagePack Serialization

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Orleans.Serialization;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure MessagePack as a serializer
            .AddSerializer(serializerBuilder => serializerBuilder.AddMessagePackSerializer());
    });

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

Example - Using MessagePack with a Custom Type

using Orleans;
using Orleans.Serialization.Cloning;
using Orleans.Serialization.Codecs;
using Orleans.Serialization.Configuration;
using Orleans.Serialization.Serializers;
using MessagePack;
namespace ExampleGrains;

// Define a class with MessagePack attributes
[MessagePackObject]
public class MyMessagePackClass
{
    [Key(0)]
    public string Name { get; set; }
    
    [Key(1)]
    public int Age { get; set; }
    
    [Key(2)]
    public List<string> Tags { get; set; }
}

// You can use it directly in your grain interfaces and implementation
public interface IMyGrain : IGrainWithStringKey
{
    Task<MyMessagePackClass> GetData();
    Task SetData(MyMessagePackClass data);
}

public class MyGrain : Grain, IMyGrain
{
    private MyMessagePackClass _data;

    public Task<MyMessagePackClass> GetData()
    {
        return Task.FromResult(_data);
    }

    public Task SetData(MyMessagePackClass data)
    {
        _data = data;
        return Task.CompletedTask;
    }
}

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

Changes from Previous Version

No structural changes between v10.1.0 and v10.1.1-preview.1.

Adoption Assessment

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

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.The published metadata declares 41 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.