public LoginUserRequestHandler(IValidator <LoginUserRequest> validator, IUnitOfWork <IUserRepository, User> userUnitOfWork,
                                ITokenService tokenService, IBackgroundTaskScheduler scheduler)
 {
     _userUnitOfWork = userUnitOfWork;
     _tokenService   = tokenService;
     _scheduler      = scheduler;
     _validator      = validator;
 }
Пример #2
0
 public ExchangeRefreshTokenRequestHandler(IValidator <ExchangeRefreshTokenRequest> validator, IUnitOfWork <IUserRepository, User> unitOfWork,
                                           ITokenService tokenService, IBackgroundTaskScheduler scheduler)
 {
     _unitOfWork   = unitOfWork;
     _validator    = validator;
     _tokenService = tokenService;
     _scheduler    = scheduler;
 }
Пример #3
0
 public HangfireBackgroundTaskInitializer(
     HangfireSettings hangfireSettings,
     IEnumerable <IBackgroundTaskRegistration> backgroundTaskRegistrations,
     IBackgroundTaskScheduler backgroundTaskScheduler
     )
 {
     _hangfireSettings            = hangfireSettings;
     _backgroundTaskRegistrations = backgroundTaskRegistrations;
     _backgroundTaskScheduler     = backgroundTaskScheduler;
 }
Пример #4
0
        public OkResult <object> Invoke(IBackgroundTaskScheduler taskScheduler)
        {
            taskScheduler.Enqueue(new ConsoleWritingBackgroundTask {
                Parameter = Parameter
            });

            return(new OkResult <object>(new
            {
                Scheduled = true,
            }));
        }
        /// <summary>
        /// Executes a number of task in a sequential fashion, one after the other.
        /// </summary>
        /// <param name="backgroundTaskScheduler">The scheduler on which to enqueue tasks.</param>
        /// <param name="tasks">The tasks that should be scheduled.</param>
        /// <param name="options">Options used to determine in what state the task should be considered for execution.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation, returning the <strong>final</strong> scheduled background task.</returns>
        public static IScheduledBackgroundTask EnqueueSequentially(
            this IBackgroundTaskScheduler backgroundTaskScheduler,
            IEnumerable <IBackgroundTask> tasks,
            BackgroundTaskContinuationOptions options = BackgroundTaskContinuationOptions.OnlyOnSucceededState)
        {
            IScheduledBackgroundTask scheduledTask = null;

            foreach (var taskToRun in tasks)
            {
                scheduledTask = scheduledTask == null?
                                backgroundTaskScheduler.Enqueue(taskToRun) :
                                    scheduledTask.ContinueWith(taskToRun, options);
            }

            return(scheduledTask);
        }
Пример #6
0
 public void Register(IBackgroundTaskScheduler scheduler)
 {
     scheduler.RegisterAsyncRecurringTask <AuthorizedTaskCleanupBackgroundTask>(_authorizedTaskCleanupSettings.BackgroundTaskFrequencyInMinutes);
 }
Пример #7
0
            public object Invoke(IBackgroundTaskScheduler taskScheduler)
            {
                taskScheduler.Enqueue(new TestBackgroundTask());

                return(ToReturn);
            }
Пример #8
0
 public void Register(IBackgroundTaskScheduler scheduler)
 {
     scheduler.RegisterAsyncRecurringTask <UserCleanupBackgroundTask>(_usersSettings.Cleanup.BackgroundTaskFrequencyInMinutes);
 }
Пример #9
0
        /// <summary>
        /// Executes the next middleware, followed by calling <see cref="IBackgroundTaskScheduler.RunNowAsync" />.
        /// </summary>
        /// <param name="context">The HTTP context.</param>
        /// <param name="backgroundTaskScheduler">The background task scheduler</param>
        /// <returns>A task representing this invocation.</returns>
        public async Task Invoke(HttpContext context, IBackgroundTaskScheduler backgroundTaskScheduler)
        {
            await this._next(context);

            await backgroundTaskScheduler.RunNowAsync();
        }