Table of Contents

Class JsonMessageDeserializerBuilder

Namespace
Silverback.Messaging.Configuration
Assembly
Silverback.Integration.dll
public sealed class JsonMessageDeserializerBuilder
Inheritance
JsonMessageDeserializerBuilder
Inherited Members

Constructors

JsonMessageDeserializerBuilder()

public JsonMessageDeserializerBuilder()

Methods

Build()

Builds the IMessageDeserializer instance.

public IMessageDeserializer Build()

Returns

IMessageDeserializer

The IMessageDeserializer.

Configure(Action<JsonSerializerOptions>)

Configures the JsonSerializerOptions.

public JsonMessageDeserializerBuilder Configure(Action<JsonSerializerOptions> configureAction)

Parameters

configureAction Action<JsonSerializerOptions>

An Action<T> that takes the JsonSerializerOptions and configures it.

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder 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 JsonMessageDeserializerBuilder IgnoreMessageTypeHeader()

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder so that additional calls can be chained.

UseModel(Type)

Specifies the message type. The deserialization will work regardless of the message type header (ideal for interoperability) and by default the message type header will be omitted by the producer (unless a subtype is being produced is called).

public JsonMessageDeserializerBuilder UseModel(Type messageType)

Parameters

messageType Type

The type of the message to serialize or deserialize.

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder so that additional calls can be chained.

UseModel<TMessage>()

Specifies the message type. The deserialization will work regardless of the message type header (ideal for interoperability) and by default the message type header will be omitted by the producer (unless a subtype is being produced is called).

public JsonMessageDeserializerBuilder UseModel<TMessage>()

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder so that additional calls can be chained.

Type Parameters

TMessage

The type of the message to serialize or deserialize.

WithMandatoryMessageTypeHeader()

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

public JsonMessageDeserializerBuilder WithMandatoryMessageTypeHeader()

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder 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 JsonMessageDeserializerBuilder WithOptionalMessageTypeHeader()

Returns

JsonMessageDeserializerBuilder

The JsonMessageDeserializerBuilder so that additional calls can be chained.