Bond Serializer Usage

Component: Bond Serializer
NuGet Package NServiceBus.Bond (1.3-pre)
This is a community run project
Target NServiceBus Version: 7.x
This page targets a pre-release version and is subject to change prior to the final release.

Configuring to use Bond

var endpointConfiguration = new EndpointConfiguration("Samples.Serialization.Bond");
endpointConfiguration.UseSerialization<BondSerializer>();

The message

[Schema]
public class CreateOrder :
    IMessage
{
    [Id(0)]
    public int OrderId { get; set; }

    [Id(1)]
    public long Date { get; set; }

    [Id(2)]
    public int CustomerId { get; set; }
}

The message send

The message is decorated with Bond Attributes.

var message = new CreateOrder
{
    OrderId = 9,
    Date = DateTime.Now.Ticks,
    CustomerId = 12,
};
await endpointInstance.SendLocal(message)
    .ConfigureAwait(false);

Note that, for simplicity, this sample does not use Bond Code generation or the Bond.Compiler.CSharp/Bond.CSharp for schema to code generation.

Related Articles


Last modified