|
123456789101112131415161718192021222324252627282930313233343536 |
- 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<MqProcessLogic> _logger;
-
- private readonly KafkaService _serviceKafka;
- public MqProcessLogic(ILogger<MqProcessLogic> 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)}");
- }
- }
-
- }
|