using HealthMonitor.Service.MessageQueue.Kafka; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace HealthMonitor.Service.MessageQueue { public class MqProcessLogic { private readonly ILogger _logger; private readonly KafkaService _serviceKafka; public MqProcessLogic(ILogger logger, KafkaService serviceKafka) { _logger = logger; _serviceKafka = serviceKafka; } public async Task ProcessIMEIEventMessageAsync(string messagesId,string topicName,object eventData) { await _serviceKafka.PublishAsync(topicName, eventData); _logger.LogInformation($"推送消息 {messagesId} 内容:{JsonConvert.SerializeObject(eventData)}"); } public async Task ProcessIMEIEventMessageAsync(string messagesId, string topicName, int dataTpe, object eventData) { await _serviceKafka.PublishAsync(topicName, dataTpe, eventData); _logger.LogInformation($"推送消息 {messagesId},数据类型:{dataTpe}, 内容:{JsonConvert.SerializeObject(eventData)}"); } } }