Пример #1
0
 public MailingNotificationTests()
 {
     CurrentTenant               = ServiceProvider.GetRequiredService <ICurrentTenant>();
     NotificationRepository      = ServiceProvider.GetRequiredService <INotificationRepository>();
     NotificationInfoRepository  = ServiceProvider.GetRequiredService <INotificationInfoRepository>();
     EmailNotificationSendingJob = ServiceProvider.GetRequiredService <IAsyncBackgroundJob <EmailNotificationSendingJobArgs> >();
 }
 public SmsNotificationTests()
 {
     JsonSerializer             = ServiceProvider.GetRequiredService <IJsonSerializer>();
     NotificationRepository     = ServiceProvider.GetRequiredService <INotificationRepository>();
     NotificationInfoRepository = ServiceProvider.GetRequiredService <INotificationInfoRepository>();
     SmsNotificationSendingJob  = ServiceProvider.GetRequiredService <IAsyncBackgroundJob <SmsNotificationSendingJobArgs> >();
 }
Пример #3
0
        private async Task Launch(IAsyncBackgroundJob job, CancellationToken token = default)
        {
            var jobId = job.Id;

            LogJobStarted(jobId);
            try
            {
                var result = await job.ExecuteAsync(token);

                LogJobResult(jobId, result);
            }
            catch (Exception e)
            {
                _logger.Error(e, "Error during execution of job {jobId}", jobId);
                throw;
            }
        }