public void Test1() { using (IJT808SessionProducer jT808MsgProducer = new JT808SessionProducer(JT808ProducerConfig)) { jT808MsgProducer.ProduceAsync("online", "123456").Wait(); jT808MsgProducer.ProduceAsync("offline", "123457").Wait(); } }
public JT808DotNettySessionNoticeServiceInherited(ILoggerFactory loggerFactory) : base(loggerFactory) { Task.Run(() => { while (true) { Thread.Sleep(5000); JT808SessionProducerConfig JT808ProducerConfig = new JT808SessionProducerConfig { TopicName = "JT808Session", BootstrapServers = "127.0.0.1:9092" }; using (IJT808SessionProducer jT808MsgProducer = new JT808SessionProducer(JT808ProducerConfig)) { jT808MsgProducer.ProduceAsync("online", "123456").Wait(); jT808MsgProducer.ProduceAsync("offline", "123457").Wait(); } } }); }