Class ProducerEndpointBuilderSerializeAsJsonUsingNewtonsoftExtensions
Adds the SerializeAsJsonUsingNewtonsoft
method to the ProducerEndpoint.
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.Newtonsoft.dll
Syntax
public static class ProducerEndpointBuilderSerializeAsJsonUsingNewtonsoftExtensions
Methods
| Improve this doc View sourceSerializeAsJsonUsingNewtonsoft<TBuilder>(IProducerEndpointBuilder<TBuilder>, Action<INewtonsoftJsonMessageSerializerBuilder>?)
Sets the serializer to an instance of NewtonsoftJsonMessageSerializer (or NewtonsoftJsonMessageSerializer<TMessage>) to serialize the produced messages as JSON.
By default this serializer forwards the message type in an header to let the consumer know which type has to be deserialized. This approach allows to mix messages of different types in the same endpoint and it's ideal when both the producer and the consumer are using Silverback but might not be optimal for interoperability. This behavior can be changed using the builder action and specifying a fixed message type.
Declaration
public static TBuilder SerializeAsJsonUsingNewtonsoft<TBuilder>(this IProducerEndpointBuilder<TBuilder> endpointBuilder, Action<INewtonsoftJsonMessageSerializerBuilder>? serializerBuilderAction = null) where TBuilder : IProducerEndpointBuilder<TBuilder>
Parameters
Type | Name | Description |
---|---|---|
IProducerEndpointBuilder<TBuilder> | endpointBuilder | The endpoint builder. |
Action<INewtonsoftJsonMessageSerializerBuilder> | serializerBuilderAction | An optional Action<T> that takes the INewtonsoftJsonMessageSerializerBuilder and configures it. |
Returns
Type | Description |
---|---|
TBuilder | The endpoint builder so that additional calls can be chained. |
Type Parameters
Name | Description |
---|---|
TBuilder | The actual builder type. |