Class SchemaRegistrySerializerBuilder<TBuilder>
- Namespace
- Silverback.Messaging.Configuration
- Assembly
- Silverback.Integration.Kafka.SchemaRegistry.dll
Builds an IMessageSerializer based on the schema registry.
public abstract class SchemaRegistrySerializerBuilder<TBuilder> where TBuilder : SchemaRegistrySerializerBuilder<TBuilder>
Type Parameters
TBuilderThe actual builder type.
- Inheritance
-
SchemaRegistrySerializerBuilder<TBuilder>
- Derived
- Inherited Members
Constructors
SchemaRegistrySerializerBuilder(IConfluentSchemaRegistryClientFactory)
Initializes a new instance of the SchemaRegistrySerializerBuilder<TBuilder> class.
protected SchemaRegistrySerializerBuilder(IConfluentSchemaRegistryClientFactory schemaRegistryClientFactory)
Parameters
schemaRegistryClientFactoryIConfluentSchemaRegistryClientFactoryThe IConfluentSchemaRegistryClientFactory to be used to create the schema registry client.
Properties
This
Gets the actual builder instance.
protected abstract TBuilder This { get; }
Property Value
- TBuilder
Methods
Build()
Builds the IMessageSerializer instance.
public IMessageSerializer Build()
Returns
BuildCore(Type, ISchemaRegistryClient)
Builds the IMessageSerializer instance.
protected abstract IMessageSerializer BuildCore(Type messageType, ISchemaRegistryClient schemaRegistryClient)
Parameters
messageTypeTypeThe type of the message to serialize.
schemaRegistryClientISchemaRegistryClientThe schema registry client.
Returns
ConnectToSchemaRegistry(Action<KafkaSchemaRegistryConfigurationBuilder>)
Configures the Confluent.SchemaRegistry.SchemaRegistryConfig.
public TBuilder ConnectToSchemaRegistry(Action<KafkaSchemaRegistryConfigurationBuilder> configurationBuilderAction)
Parameters
configurationBuilderActionAction<KafkaSchemaRegistryConfigurationBuilder>An Action<T> that takes the Confluent.SchemaRegistry.SchemaRegistryConfig and configures it.
Returns
- TBuilder
The builder so that additional calls can be chained.
ConnectToSchemaRegistry(string, Action<KafkaSchemaRegistryConfigurationBuilder>?)
Configures the Confluent.SchemaRegistry.SchemaRegistryConfig.
public TBuilder ConnectToSchemaRegistry(string url, Action<KafkaSchemaRegistryConfigurationBuilder>? configurationBuilderAction = null)
Parameters
urlstringThe comma-separated list of URLs for schema registry instances.
configurationBuilderActionAction<KafkaSchemaRegistryConfigurationBuilder>An optional Action<T> that takes the Confluent.SchemaRegistry.SchemaRegistryConfig and configures it.
Returns
- TBuilder
The builder so that additional calls can be chained.
UseModel(Type)
Specifies the message type.
public TBuilder UseModel(Type messageType)
Parameters
messageTypeTypeThe type of the message to serialize or serialize.
Returns
- TBuilder
The builder so that additional calls can be chained.
UseModel<TMessage>()
Specifies the message type.
public TBuilder UseModel<TMessage>() where TMessage : class
Returns
- TBuilder
The builder so that additional calls can be chained.
Type Parameters
TMessageThe type of the message to serialize.