Class ProducerEndpointBuilderSerializeAsJsonExtensions
Adds the SerializeAsJson
method to the ProducerEndpoint.
Inherited Members
Namespace: Silverback.Messaging.Configuration
Assembly: Silverback.Integration.dll
Syntax
public static class ProducerEndpointBuilderSerializeAsJsonExtensions
Methods
| Improve this doc View sourceSerializeAsJson<TBuilder>(IProducerEndpointBuilder<TBuilder>, Action<IJsonMessageSerializerBuilder>?)
Sets the serializer to an instance of JsonMessageSerializer (or JsonMessageSerializer<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 SerializeAsJson<TBuilder>(this IProducerEndpointBuilder<TBuilder> endpointBuilder, Action<IJsonMessageSerializerBuilder>? serializerBuilderAction = null) where TBuilder : IProducerEndpointBuilder<TBuilder>
Parameters
Type | Name | Description |
---|---|---|
IProducerEndpointBuilder<TBuilder> | endpointBuilder | The endpoint builder. |
Action<IJsonMessageSerializerBuilder> | serializerBuilderAction | An optional Action<T> that takes the IJsonMessageSerializerBuilder 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. |