Beispiel #1
0
        public static void Run([QueueTrigger("scannernotifications", Connection = "connstr")] string message, ILogger log)
        {
            try
            {
                log.LogInformation("Received scanner notification from queue: " + message);
                //TODO: Add twilio message sending and later on web PUSH-notifications
                var notificationService = new NotificationService();
                var scannerNotification = Mappers.MapStrToScannerNotificationDTO(message);

                var       dbConnStr = Environment.GetEnvironmentVariable("DbConn");
                DbService dbService = new DbService();
                dbService.SetConnectionString(dbConnStr);
                dbService.StoreScannerNotification(scannerNotification);
                notificationService.SendScannerNotification(scannerNotification);
                log.LogInformation("Scanner notification processed");
            } catch (Exception exp)
            {
                log.LogError("Exception occurred when processing scanner notification : " + exp.Message);
                log.LogError("Stack trace : " + exp.StackTrace);
            }
        }
Beispiel #2
0
        public static void Run([QueueTrigger("eventlogs", Connection = "connstr")] string message, ILogger log)
        {
            try
            {
                log.LogInformation("Received event log from queue : " + message);
                var dbConnStr = Environment.GetEnvironmentVariable("DbConn");

                var eventLog = Mappers.MapStrToStrategyEventLog(message);

                DbService dbService = new DbService();
                dbService.SetConnectionString(dbConnStr);
                dbService.StoreStrategyLogEvent(eventLog);
                //TODO: Refactor this to be part of notification service
                webPushNotifier.SetConnectionString(dbConnStr);
                webPushNotifier.WebPush(eventLog);
                log.LogInformation("Event log message processed");
            } catch (Exception exp)
            {
                log.LogError("Exception occurred when processing log event message : " + exp.Message);
                log.LogError("Stack trace : " + exp.StackTrace);
            }
        }