/// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="deserializerBuilder">
 /// A deserializer builder.
 /// </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">
 /// The behavior of the deserializer on tombstone records.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroValueDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     SchemaRegistryDeserializerBuilder deserializerBuilder,
     string subject,
     TombstoneBehavior tombstoneBehavior = TombstoneBehavior.None
     ) => consumerBuilder.SetValueDeserializer(
     await deserializerBuilder.Build <TValue>(subject, tombstoneBehavior).ConfigureAwait(false));
 /// <summary>
 /// Set the message key deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="deserializerBuilder">
 /// A deserializer builder.
 /// </param>
 /// <param name="subject">
 /// The subject of the schema that should be used to deserialize keys.
 /// </param>
 /// <param name="version">
 /// The version of the subject to be resolved.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     SchemaRegistryDeserializerBuilder deserializerBuilder,
     string subject,
     int version
     ) => consumerBuilder.SetKeyDeserializer(
     await deserializerBuilder.Build <TKey>(subject, version).ConfigureAwait(false));
        /// <summary>
        /// Sets an Avro deserializer for keys.
        /// </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 keys.
        /// </param>
        /// <returns>
        /// <paramref name="consumerBuilder" /> with an Avro deserializer configured for
        /// <typeparamref name="TKey" />.
        /// </returns>
        public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
            this ConsumerBuilder <TKey, TValue> consumerBuilder,
            ISchemaRegistryClient registryClient,
            int id)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient);

            return(await consumerBuilder
                   .SetAvroKeyDeserializer(deserializerBuilder, id)
                   .ConfigureAwait(false));
        }
        /// <summary>
        /// Sets an Avro deserializer for keys.
        /// </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 keys. The latest version
        /// of the subject will be resolved.
        /// </param>
        /// <returns>
        /// <paramref name="consumerBuilder" /> with an Avro deserializer configured for
        /// <typeparamref name="TKey" />.
        /// </returns>
        public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
            this ConsumerBuilder <TKey, TValue> consumerBuilder,
            IEnumerable <KeyValuePair <string, string> > registryConfiguration,
            string subject)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryConfiguration);

            return(await consumerBuilder
                   .SetAvroKeyDeserializer(deserializerBuilder, subject)
                   .ConfigureAwait(false));
        }
 /// <summary>
 /// Set the message key 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="id">
 /// The ID of the schema that should be used to deserialize keys.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     IEnumerable <KeyValuePair <string, string> > registryConfiguration,
     int id
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryConfiguration))
     {
         return(await consumerBuilder.SetAvroKeyDeserializer(deserializerBuilder, id));
     }
 }
 /// <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>
        /// 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="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,
            ISchemaRegistryClient registryClient,
            string subject,
            TombstoneBehavior tombstoneBehavior = TombstoneBehavior.None)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient);

            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="registryConfiguration">
        /// A Schema Registry configuration. Using the <see cref="SchemaRegistryConfig" /> class is
        /// highly recommended.
        /// </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,
            IEnumerable <KeyValuePair <string, string> > registryConfiguration,
            int id,
            TombstoneBehavior tombstoneBehavior = TombstoneBehavior.None)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryConfiguration);

            return(await consumerBuilder
                   .SetAvroValueDeserializer(deserializerBuilder, id, tombstoneBehavior)
                   .ConfigureAwait(false));
        }
 /// <summary>
 /// Set the message key 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 keys.
 /// </param>
 /// <param name="version">
 /// The version of the subject to be resolved.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     ISchemaRegistryClient registryClient,
     string subject,
     int version
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient))
     {
         return(await consumerBuilder.SetAvroKeyDeserializer(deserializerBuilder, subject, version).ConfigureAwait(false));
     }
 }
 /// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="deserializerBuilder">
 /// A deserializer builder.
 /// </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,
     SchemaRegistryDeserializerBuilder deserializerBuilder,
     string subject
     ) => consumerBuilder.SetValueDeserializer(await deserializerBuilder.Build <TValue>(subject));
 /// <summary>
 /// Set the message key deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="deserializerBuilder">
 /// A deserializer builder.
 /// </param>
 /// <param name="id">
 /// The ID of the schema that should be used to deserialize keys.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     SchemaRegistryDeserializerBuilder deserializerBuilder,
     int id
     ) => consumerBuilder.SetKeyDeserializer(await deserializerBuilder.Build <TKey>(id));
Exemplo n.º 12
0
 /// <summary>
 /// Set the message value deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="deserializerBuilder">
 /// A deserializer builder.
 /// </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,
     SchemaRegistryDeserializerBuilder deserializerBuilder,
     int id
     ) => consumerBuilder.SetValueDeserializer(await deserializerBuilder.Build <TValue>(id).ConfigureAwait(false));