Class JsonMessageDeserializerBuilder
Builds the JsonMessageDeserializer<TMessage>.
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public sealed class JsonMessageDeserializerBuilder
Constructors
JsonMessageDeserializerBuilder()
Builds the JsonMessageDeserializer<TMessage>.
Declaration
public JsonMessageDeserializerBuilder()
Methods
Build()
Builds the IMessageDeserializer instance.
Declaration
public IMessageDeserializer Build()
Returns
| Type | Description |
|---|---|
| IMessageDeserializer | The IMessageDeserializer. |
Configure(Action<JsonSerializerOptions>)
Configures the JsonSerializerOptions.
Declaration
public JsonMessageDeserializerBuilder Configure(Action<JsonSerializerOptions> configureAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<JsonSerializerOptions> | configureAction | An Action<T> that takes the JsonSerializerOptions and configures it. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public JsonMessageDeserializerBuilder IgnoreMessageTypeHeader()
Returns
| Type | Description |
|---|---|
| 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).
Declaration
public JsonMessageDeserializerBuilder UseModel(Type messageType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | messageType | The type of the message to serialize or deserialize. |
Returns
| Type | Description |
|---|---|
| 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).
Declaration
public JsonMessageDeserializerBuilder UseModel<TMessage>()
Returns
| Type | Description |
|---|---|
| JsonMessageDeserializerBuilder | The JsonMessageDeserializerBuilder so that additional calls can be chained. |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public JsonMessageDeserializerBuilder WithMandatoryMessageTypeHeader()
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public JsonMessageDeserializerBuilder WithOptionalMessageTypeHeader()
Returns
| Type | Description |
|---|---|
| JsonMessageDeserializerBuilder | The JsonMessageDeserializerBuilder so that additional calls can be chained. |