NServiceBus takes instances of .NET objects (messages, events and commands) and then sends/receives them over a specified Transport. As part of this the object need to be serialized and deserialized. To achieve this NServiceBus uses Serializers.
- Message Pack
- Binary (deprecated in Versions 6 and above)
The default serializer used in NServiceBus projects is the custom XmlSerializer.
The pages dedicated to particular Serializers show how to configure the endpoint to use each of them. Unless explicitly configured otherwise, NServiceBus will use XmlSerializer for serializing and deserializing all messages.
In order to register community run serializer or custom serializer, refer to the Custom serializers - Register the serializer section.
To support sending and receiving messages between endpoints using different serializers, additional deserialization capability may be specified. It is possible to register additional deserializers to process incoming messages. Additionally, if a deserializer requires custom settings, they can be provided during its registration.
// configures XML serialization as default endpointConfiguration.UseSerialization<XmlSerializer>(); // configures additional deserialization var mySerializer = endpointConfiguration.AddDeserializer<MyCustomSerializerDefinition>(); mySerializer.Settings("serializerSetting");
There are several community run Serializers that can be seen on the list of NServiceBus Extensions.