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 lines
857B

  1. using Microsoft.Extensions.Logging;
  2. using Newtonsoft.Json;
  3. using NearCardAttendance.Service.MessageQueue.Kafka;
  4. using NearCardAttendance.Service.MessageQueue.Model;
  5. namespace NearCardAttendance.Service.MessageQueue
  6. {
  7. public class MqProcessLogic
  8. {
  9. private readonly ILogger<MqProcessLogic> _logger;
  10. private readonly KafkaService _serviceKafka;
  11. public MqProcessLogic(ILogger<MqProcessLogic> logger, KafkaService serviceKafka)
  12. {
  13. _logger = logger;
  14. _serviceKafka = serviceKafka;
  15. }
  16. public async Task ProcessIMEIEventMessageAsync(EventData eventData)
  17. {
  18. await _serviceKafka.PublishAsync(eventData.TopicName, eventData);
  19. _logger.LogInformation($"推送消息 {eventData.MessageId} 内容:{JsonConvert.SerializeObject(eventData)}");
  20. }
  21. }
  22. }