/// <summary> /// Creates a serializer builder. /// </summary> /// <param name="registryClient"> /// The client to use for Schema Registry operations. (The client will not be disposed.) /// </param> /// <param name="schemaBuilder"> /// The schema builder to use to create a schema for a C# type when registering automatically. /// If none is provided, the default schema builder will be used. /// </param> /// <param name="schemaReader"> /// The JSON schema reader to use to convert schemas received from the registry into abstract /// representations. If none is provided, the default schema reader will be used. /// </param> /// <param name="schemaWriter"> /// The JSON schema writer to use to convert abstract schema representations when registering /// automatically. If none is provided, the default schema writer will be used. /// </param> /// <param name="serializerBuilder"> /// The deserializer builder to use to build serialization functions for C# types. If none /// is provided, the default serializer builder will be used. /// </param> /// <exception cref="ArgumentNullException"> /// Thrown when the registry client is null. /// </exception> public SchemaRegistrySerializerBuilder( ISchemaRegistryClient registryClient, Abstract.ISchemaBuilder?schemaBuilder = null, IJsonSchemaReader?schemaReader = null, IJsonSchemaWriter?schemaWriter = null, Serialization.IBinarySerializerBuilder?serializerBuilder = null ) { _disposeRegistryClient = false; RegistryClient = registryClient ?? throw new ArgumentNullException(nameof(registryClient)); SchemaBuilder = schemaBuilder ?? new Abstract.SchemaBuilder(); SchemaReader = schemaReader ?? new JsonSchemaReader(); SchemaWriter = schemaWriter ?? new JsonSchemaWriter(); SerializerBuilder = serializerBuilder ?? new Serialization.BinarySerializerBuilder(); }
/// <summary> /// Creates a serializer builder. /// </summary> /// <param name="registryConfiguration"> /// Schema Registry configuration. Using the <see cref="SchemaRegistryConfig" /> class is /// highly recommended. /// </param> /// <param name="schemaBuilder"> /// The schema builder to use to create a schema for a C# type when registering automatically. /// If none is provided, the default schema builder will be used. /// </param> /// <param name="schemaReader"> /// The JSON schema reader to use to convert schemas received from the registry into abstract /// representations. If none is provided, the default schema reader will be used. /// </param> /// <param name="schemaWriter"> /// The JSON schema writer to use to convert abstract schema representations when registering /// automatically. If none is provided, the default schema writer will be used. /// </param> /// <param name="serializerBuilder"> /// The deserializer builder to use to build serialization functions for C# types. If none /// is provided, the default serializer builder will be used. /// </param> public SchemaRegistrySerializerBuilder( IEnumerable <KeyValuePair <string, string> > registryConfiguration, Abstract.ISchemaBuilder schemaBuilder = null, IJsonSchemaReader schemaReader = null, IJsonSchemaWriter schemaWriter = null, Serialization.IBinarySerializerBuilder serializerBuilder = null ) : this( new CachedSchemaRegistryClient(registryConfiguration), schemaBuilder, schemaReader, schemaWriter, serializerBuilder ) { _disposeRegistryClient = true; }