コード例 #1
0
 /// <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="subject">
 /// The subject of the schema that should be used to deserialize keys. The latest version
 /// of the subject will be resolved.
 /// </param>
 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));
     }
 }
コード例 #2
0
 /// <summary>
 /// Set the message key deserializer.
 /// </summary>
 /// <param name="consumerBuilder">
 /// The <see cref="ConsumerBuilder{TKey, TValue}" /> instance to be configured.
 /// </param>
 /// <param name="registryClient">
 /// A 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. The latest version
 /// of the subject will be resolved.
 /// </param>
 public static async Task <ConsumerBuilder <TKey, TValue> > SetAvroKeyDeserializer <TKey, TValue>(
     this ConsumerBuilder <TKey, TValue> consumerBuilder,
     ISchemaRegistryClient registryClient,
     string subject
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient))
     {
         return(await consumerBuilder.SetAvroKeyDeserializer(deserializerBuilder, subject));
     }
 }
コード例 #3
0
        /// <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="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>
        /// <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,
            string subject,
            int version)
        {
            using var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient);

            return(await consumerBuilder
                   .SetAvroKeyDeserializer(deserializerBuilder, subject, version)
                   .ConfigureAwait(false));
        }
コード例 #4
0
 /// <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="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,
     ISchemaRegistryClient registryClient,
     int id
     )
 {
     using (var deserializerBuilder = new SchemaRegistryDeserializerBuilder(registryClient))
     {
         return(await consumerBuilder
                .SetAvroKeyDeserializer(deserializerBuilder, id)
                .ConfigureAwait(false));
     }
 }