MessagePack Serializer Usage

Component: MessagePack Serializer
NuGet Package NServiceBus.MessagePack (2.x)
This is a community run project
Target NServiceBus Version: 6.x

Configuring to use MessagePack

var endpointConfiguration = new EndpointConfiguration("Samples.Serialization.MessagePack");
var serialization = endpointConfiguration.UseSerialization<MessagePackSerializer>();
serialization.Resolver(ContractlessStandardResolver.Instance);

The message send

var message = new CreateOrder
{
    OrderId = 9,
    Date = DateTime.Now,
    CustomerId = 12,
    OrderItems = new List<OrderItem>
    {
        new OrderItem
        {
            ItemId = 6,
            Quantity = 2
        },
        new OrderItem
        {
            ItemId = 5,
            Quantity = 4
        },
    }
};
await endpointInstance.SendLocal(message)
    .ConfigureAwait(false);

Related Articles


Last modified