Exemplo n.º 1
0
        public void Setup(CancellationToken stoppingToken)
        {
            _stoppingToken = stoppingToken;
            _messageSender = MessageBusServiceFactory.CreateServiceBusMessageSender(_serviceBusConfiguration, _logger);

            FileUtil.CreateLocalDirectoriesInPath(_blobConfiguration.ImageStorePath);
        }
Exemplo n.º 2
0
 public MessagesScope(MessagesToPublish messagesToPublish, ILogger <MessagesScope> logger, IQueueMessageSender queueMessageSender, IPublisher publisher, IActivitySourceFactory activitySourceFactory)
 {
     _messagesToPublish  = messagesToPublish;
     _logger             = logger;
     _queueMessageSender = queueMessageSender;
     _publisher          = publisher;
     _activitySource     = activitySourceFactory.GetArc4u();
 }
        public async Task ExecuteDataFiltering(AttendanceRecord attendanceRecord, ILogger logger)
        {
            try
            {
                if (attendanceRecord == null)
                {
                    throw new ArgumentException(AttendanceRecordNullMessage);
                }

                logger.LogInformation($"Running TemperatureDataFilter sbconnection : {_notificationServiceBusConfiguration.ServiceBusConnection}, queue : {_notificationServiceBusConfiguration.QueueName} and temperature max : {_temperatureFilterConfiguration.Max} ");

                if (attendanceRecord.BodyTemperature > _temperatureFilterConfiguration.Max)
                {
                    _messageSender = MessageBusServiceFactory.CreateServiceBusMessageSender(_notificationServiceBusConfiguration, logger);

                    var mailParam = new EmailTemperatureHitParameter(attendanceRecord.DeviceId, _temperatureFilterConfiguration.EmailTemplateMaxTemperatureHit);

                    mailParam.Location = attendanceRecord.Address;
                    mailParam.TemperatureRegistered = attendanceRecord.BodyTemperature;
                    mailParam.Image     = attendanceRecord.Img;
                    mailParam.Timestamp = attendanceRecord.TimeStamp;

                    var mailData = _mailContentParser.CreateTemperatureEmailAlertMessage(mailParam, logger);

                    if (mailData != null)
                    {
                        var messgeInstance = MessageConverter.Serialize(mailData);
                        await _messageSender.SendMessagesAsync(messgeInstance);

                        logger.LogInformation("MailData message sent to queue.");
                    }
                    else
                    {
                        logger.LogInformation($"No notifcation sent to queue. {DateTime.Now}");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.LogInformation($"Notfication filter failed. {ex.Message}. {ex.StackTrace}");
            }
        }
Exemplo n.º 4
0
 public TodoChangeTrigger(ILogger <TodoChangeTrigger> logger, IQueueMessageSender queueMessageSender)
 {
     _logger             = logger;
     _queueMessageSender = queueMessageSender;
 }
 public MessagesController(IQueueMessageSender sender)
 {
     _sender = sender;
 }
Exemplo n.º 6
0
 public void Setup()
 {
     targetBaseUrl       = _restConfiguration.Hostname;
     thermoDataRequester = RequestFactory.CreateRestService(targetBaseUrl, _stoppingToken, _logger);
     _messageSender      = MessageBusServiceFactory.CreateServiceBusMessageSender(_serviceBusConfiguration, _logger);
 }