You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 line
758 B

  1. using Confluent.Kafka;
  2. using JT809.PubSub.Abstractions;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace JT809.KafkaService
  7. {
  8. public abstract class JT809ProducerBase<T> : IJT809ProducerOfT<T>
  9. {
  10. protected JT809ProducerBase(string topicName,ProducerConfig config)
  11. {
  12. ProducerConfig = config;
  13. TopicName = topicName;
  14. }
  15. public ProducerConfig ProducerConfig { get;}
  16. public string TopicName { get; }
  17. protected abstract IProducer<string, T> Producer { get;}
  18. protected virtual Serializer<T> Serializer { get; set; }
  19. public abstract void Dispose();
  20. public abstract void ProduceAsync(string msgId, string vno_color, T data);
  21. }
  22. }