/// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="registryClient">
 /// The client to use to resolve the schema. (The client will not be disposed.)
 /// </param>
 /// <param name="subject">
 /// The subject of the schema that should be used to deserialize values. The latest version
 /// of the subject will be resolved.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     ISchemaRegistryClient registryClient,
     string subject
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient))
     {
         return(await consumerBuilder.SetAvroValueDeserializer(deserializerBuilder, subject));
     }
 }
 /// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="registryConfiguration">
 /// Schema Registry configuration. Using the <see cref="SchemaRegistryConfig" /> class is
 /// highly recommended.
 /// </param>
 /// <param name="subject">
 /// The subject of the schema that should be used to deserialize values. The latest version
 /// of the subject will be resolved.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     IEnumerable <KeyValuePair <string, string> > registryConfiguration,
     string subject
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryConfiguration))
     {
         return(await consumerBuilder.SetAvroValueDeserializer(deserializerBuilder, subject));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="registryClient">
 /// The client to use to resolve the schema. (The client will not be disposed.)
 /// </param>
 /// <param name="id">
 /// The ID of the schema that should be used to deserialize values.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     ISchemaRegistryClient registryClient,
     int id
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient))
     {
         return(await consumerBuilder.SetAvroValueDeserializer(deserializerBuilder, id).ConfigureAwait(false));
     }
 }
        /// <summary>
        /// Sets an Avro deserializer for values.
        /// </summary>
        /// <typeparam name="TKey">
        /// The type of key to be deserialized.
        /// </typeparam>
        /// <typeparam name="TValue">
        /// The type of value to be deserialized.
        /// </typeparam>
        /// <param name="consumerBuilder">
        /// A <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
        /// </param>
        /// <param name="registryConfiguration">
        /// A Schema Registry configuration. Using the <see cref="SchemaRegistryConfig" /> class is
        /// highly recommended.
        /// </param>
        /// <param name="subject">
        /// The subject of the schema that should be used to deserialize values. The latest version
        /// of the subject will be resolved.
        /// </param>
        /// <param name="tombstoneBehavior">
        /// How the deserializer should handle tombstone records.
        /// </param>
        /// <returns>
        /// <paramref name="consumerBuilder" /> with an Avro deserializer configured for
        /// <typeparamref name="TValue" />.
        /// </returns>
        public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
            this ConsumerBuilder <TKey, TValue> consumerBuilder,
            IEnumerable <KeyValuePair <string, string> > registryConfiguration,
            string subject,
            TombstoneBehavior tombstoneBehavior = TombstoneBehavior.None)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryConfiguration);

            return(await consumerBuilder
                   .SetAvroValueDeserializer(deserializerBuilder, subject, tombstoneBehavior)
                   .ConfigureAwait(false));
        }
        /// <summary>
        /// Sets an Avro deserializer for values.
        /// </summary>
        /// <typeparam name="TKey">
        /// The type of key to be deserialized.
        /// </typeparam>
        /// <typeparam name="TValue">
        /// The type of value to be deserialized.
        /// </typeparam>
        /// <param name="consumerBuilder">
        /// A <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
        /// </param>
        /// <param name="registryClient">
        /// A Schema Registry client to use to resolve the schema. (The client will not be
        /// disposed.)
        /// </param>
        /// <param name="id">
        /// The ID of the schema that should be used to deserialize values.
        /// </param>
        /// <param name="tombstoneBehavior">
        /// How the deserializer should handle tombstone records.
        /// </param>
        /// <returns>
        /// <paramref name="consumerBuilder" /> with an Avro deserializer configured for
        /// <typeparamref name="TValue" />.
        /// </returns>
        public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
            this ConsumerBuilder <TKey, TValue> consumerBuilder,
            ISchemaRegistryClient registryClient,
            int id,
            TombstoneBehavior tombstoneBehavior = TombstoneBehavior.None)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient);

            return(await consumerBuilder
                   .SetAvroValueDeserializer(deserializerBuilder, id, tombstoneBehavior)
                   .ConfigureAwait(false));
        }