Table of Contents

Class NewtonsoftJsonMessageDeserializerBuilder

Namespace
Silverback.Messaging.Configuration
Assembly
Silverback.Integration.Newtonsoft.dll
public class NewtonsoftJsonMessageDeserializerBuilder
Inheritance
NewtonsoftJsonMessageDeserializerBuilder
Inherited Members

Constructors

NewtonsoftJsonMessageDeserializerBuilder()

public NewtonsoftJsonMessageDeserializerBuilder()

Methods

Build()

Builds the IMessageDeserializer instance.

public IMessageDeserializer Build()

Returns

IMessageDeserializer

The IMessageDeserializer.

Configure(Action<JsonSerializerSettings>)

Configures the Newtonsoft.Json.JsonSerializerSettings.

public NewtonsoftJsonMessageDeserializerBuilder Configure(Action<JsonSerializerSettings> configureAction)

Parameters

configureAction Action<JsonSerializerSettings>

An Action<T> that takes the Newtonsoft.Json.JsonSerializerSettings and configures it.

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

IgnoreMessageTypeHeader()

Specifies that the message type header must be ignored. The message will always be deserialized into the predefined model.

public NewtonsoftJsonMessageDeserializerBuilder IgnoreMessageTypeHeader()

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

UseModel(Type)

Specifies a fixed message type. This will prevent the message type header to be written when serializing and the header will be ignored when deserializing.

public NewtonsoftJsonMessageDeserializerBuilder UseModel(Type messageType)

Parameters

messageType Type

The type of the message to serialize or deserialize.

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

UseModel<TMessage>()

Specifies a fixed message type. This will prevent the message type header to be written when serializing and the header will be ignored when deserializing.

public NewtonsoftJsonMessageDeserializerBuilder UseModel<TMessage>()

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

Type Parameters

TMessage

The type of the message to serialize or deserialize.

WithEncoding(MessageEncoding)

Specifies the encoding to be used.

public NewtonsoftJsonMessageDeserializerBuilder WithEncoding(MessageEncoding encoding)

Parameters

encoding MessageEncoding

The MessageEncoding.

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

WithMandatoryMessageTypeHeader()

Specifies that an exception must be thrown if the consumed message doesn't specify the message type header.

public NewtonsoftJsonMessageDeserializerBuilder WithMandatoryMessageTypeHeader()

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.

WithOptionalMessageTypeHeader()

Specifies that the message type header must be used when sent with the consumed message, otherwise the predefined model has to be used.

public NewtonsoftJsonMessageDeserializerBuilder WithOptionalMessageTypeHeader()

Returns

NewtonsoftJsonMessageDeserializerBuilder

The NewtonsoftJsonMessageDeserializerBuilder so that additional calls can be chained.