public StackPowerKickstarter(
			IScheduleCalculator scheduleCalculator,
			IBackgroundJobClient backgroundJobClient)
        {
            _scheduleCalculator = scheduleCalculator;
            _backgroundJobClient = backgroundJobClient;
        }
        public RefreshEverything(
			IRepository<AwsProfile> profileRepository,
			IBackgroundJobClient backgroundJobClient)
        {
            _profileRepository = profileRepository;
            _backgroundJobClient = backgroundJobClient;
        }
 public HistogramController(IHistogramRepository repository, IUserEventRepository userEventRepository, IGenerate<Histogram> generateHistogram, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
 {
     this.repository = repository;
     this.userEventRepository = userEventRepository;
     this.generateHistogram = generateHistogram;
     this.featureRepository = featureRepository;
     this.backgroundJobClient = backgroundJobClient;
 }
Example #4
0
        public RecurringJobManager([NotNull] JobStorage storage, [NotNull] IBackgroundJobClient client)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");

            _storage = storage;
            _client = client;
        }
 public TimeSeriesController(ApiDataContext context, ITimeSeriesRepository timeSeriesRepository, IUserEventRepository userEventRepository, IGenerate<TimeSeries> generateTimeSeries, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
 {
     this.context = context;
     this.timeSeriesRepository = timeSeriesRepository;
     this.userEventRepository = userEventRepository;
     this.generateTimeSeries = generateTimeSeries;
     this.featureRepository = featureRepository;
     this.backgroundJobClient = backgroundJobClient;
 }
        public RemoveStaleInstances(
			IAwsClientFactory awsClientFactory,
			IRepository<Instance> instanceRepository,
			IRepository<AwsProfile> profileRepository,
			IBackgroundJobClient backgroundJobClient)
            : base(profileRepository, awsClientFactory)
        {
            _instanceRepository = instanceRepository;
            _backgroundJobClient = backgroundJobClient;
        }
Example #7
0
 public HangfireJobScheduler(
     ILog log,
     IJsonSerializer jsonSerializer,
     IBackgroundJobClient backgroundJobClient,
     IJobDefinitionService jobDefinitionService)
 {
     _log = log;
     _jsonSerializer = jsonSerializer;
     _backgroundJobClient = backgroundJobClient;
     _jobDefinitionService = jobDefinitionService;
 }
 public JobsHelper(IMetadataContext context, 
     IDownloadToStream downloader, 
     ICustomMetadataReader reader, IBackgroundJobClient client, 
     IPostNotificationSender sender)
 {
     _context = context;
     _downloader = downloader;
     _reader = reader;
     _client = client;
     _sender = sender;
 }
        public RecurringJobScheduler(
            [NotNull] JobStorage storage, 
            [NotNull] IBackgroundJobClient client, 
            [NotNull] IDateTimeProvider dateTimeProvider)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");
            if (dateTimeProvider == null) throw new ArgumentNullException("dateTimeProvider");

            _storage = storage;
            _client = client;
            _dateTimeProvider = dateTimeProvider;
        }
        public ScheduledStopStack(
			IRepository<Stack> stackRepository,
			IRepository<Instance> instanceRepository,
			IInstancePower startInstances,
			IScheduleCalculator scheduleCalculator,
			IBackgroundJobClient backgroundJobClient)
        {
            _stackRepository = stackRepository;
            _instanceRepository = instanceRepository;
            _stopInstances = startInstances;
            _scheduleCalculator = scheduleCalculator;
            _backgroundJobClient = backgroundJobClient;
        }
        public AwsProfileController(
			IRepository<AwsProfile> profileRepository,
			IRepository<IPRange> ipRangeRepository,
			ICryptoProvider cryptoProvider,
			IBackgroundJobClient backgroundJobClient,
			IAuthenticatedUserClient userClient,
			IAwsClientFactory awsClientFactory)
        {
            _profileRepository = profileRepository;
            _ipRangeRepository = ipRangeRepository;
            _cryptoProvider = cryptoProvider;
            _backgroundJobClient = backgroundJobClient;
            _userClient = userClient;
            _awsClientFactory = awsClientFactory;
        }
        public RecurringJobScheduler(
            [NotNull] JobStorage storage,
            [NotNull] IBackgroundJobClient client,
            [NotNull] IScheduleInstantFactory instantFactory,
            [NotNull] IThrottler throttler)
        {
            if (storage == null) throw new ArgumentNullException("storage");
            if (client == null) throw new ArgumentNullException("client");
            if (instantFactory == null) throw new ArgumentNullException("instantFactory");
            if (throttler == null) throw new ArgumentNullException("throttler");

            _storage = storage;
            _client = client;
            _instantFactory = instantFactory;
            _throttler = throttler;
        }
        public void Setup()
        {
            _context = Mock.Of<IMetadataContext>();
            _scheduledImages = Mock.Of<DbSet<ScheduledImage>>();

            _downloader = Mock.Of<IDownloadToStream>();

            _metadataReader = Mock.Of<ICustomMetadataReader>();

            _client = Mock.Of<IBackgroundJobClient>();

            _postNotificationSender = Mock.Of<IPostNotificationSender>();

            Mock.Get(_scheduledImages).Setup(si => si.Find(It.IsAny<int>())).Returns(new ScheduledImage());
            Mock.Get(_context).Setup(c => c.ScheduledImages).Returns(_scheduledImages);
            Mock.Get(_metadataReader).Setup(m => m.ReadFromStream(It.IsAny<MemoryStream>())).Returns(new List<ImageMetadataTag>());
        }
Example #14
0
 public RequestApiController(IMediator mediator, IBackgroundJobClient backgroundjobClient)
 {
     this.backgroundjobClient = backgroundjobClient;
     this.mediator            = mediator;
 }
Example #15
0
 public FibonacciController(
     IBackgroundJobClient backgroundJobClient
     )
 {
     _backgroundJobClient = backgroundJobClient;
 }
 public JobEmailRepository(IDbContextResolver contextResolver,
                           IBackgroundJobClient backgroundJobClient) : base(contextResolver)
 {
     BackgroundJobClient = backgroundJobClient;
 }
 public SmsRequestController(IBackgroundJobClient jobClient, IChangeRequestStatus changeRequestStatus)
 {
     this.jobClient = jobClient;
     this.changeRequestStatus = changeRequestStatus;
 }
Example #18
0
 public NewsletterService(IOptions <NewsletterServiceOptions> options, ILogger <NewsletterService> logger, IBackgroundJobClient jobClient)
 {
     newsletterListId = options.Value.MailChimpNewsletterListId;
     mailChimpManager = new MailChimpManager(new MailChimpOptions()
     {
         ApiKey = options.Value.MailChimpKey
     });
     this.jobClient = jobClient;
     this.logger    = logger;
 }
Example #19
0
 public ChargerService(IOpenChargeHttpClient openChargeHttpClient, WorkDbContext workDbContext, IMapper mapper, IBackgroundJobClient backgroundJobClient)
 {
     _openChargeHttpClient = openChargeHttpClient;
     _workDbContext        = workDbContext;
     _mapper = mapper;
     _backgroundJobClient = backgroundJobClient;
 }
Example #20
0
 public PaymentsController(IMediator mediator, IBackgroundJobClient backgroundJobClient)
 {
     _mediator            = mediator;
     _backgroundJobClient = backgroundJobClient;
 }
Example #21
0
 public InitializationService(UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, IOptions <SeedOptions> seedOptions, ICrowdactionService crowdactionService, IImageService imageService, IBackgroundJobClient jobClient, ApplicationDbContext context, ILogger <InitializationService> logger)
 {
     this.userManager        = userManager;
     this.roleManager        = roleManager;
     this.seedOptions        = seedOptions.Value;
     this.crowdactionService = crowdactionService;
     this.imageService       = imageService;
     this.jobClient          = jobClient;
     this.context            = context;
     this.logger             = logger;
 }
 /// <summary>
 /// Changes state of a job with the specified <paramref name="jobId"/>
 /// to the <see cref="EnqueuedState"/>.
 /// </summary>
 ///
 /// <param name="client">An instance of <see cref="IBackgroundJobClient"/> implementation.</param>
 /// <param name="jobId">Identifier of job, whose state is being changed.</param>
 /// <returns>True, if state change succeeded, otherwise false.</returns>
 public static bool Requeue([NotNull] this IBackgroundJobClient client, string jobId)
 {
     return(Requeue(client, jobId, null));
 }
 public static string ContinueWith(this IBackgroundJobClient client, string parentId,
                                   [InstantHandle] Expression <Action> methodCall)
 {
     return(ContinueWith(client, parentId, methodCall, new EnqueuedState()));
 }
 public BackEndJobExampleNotification(IBackgroundJobClient backgroundJobClient)
 {
     this.backgroundJobClient = backgroundJobClient;
 }
Example #25
0
 public BackgroundJobService(IBackgroundJobClient backgroundJobClient, IRecurringJobManager recurringJobManager)
 {
     _backgroundJobClient = backgroundJobClient;
     _recurringJobManager = recurringJobManager;
 }
 public CreateInstallmentMovementCommandHandler(IUserRepository repository, IAccountRepository accountRepository,
                                                ITransactionService transactionService, IBackgroundJobClient backgroundJobClient,
                                                IInstallmentMovementRepository installmentMovementRepository)
 {
     _userRepository                = repository;
     _accountRepository             = accountRepository;
     _transactionService            = transactionService;
     _backgroundJobClient           = backgroundJobClient;
     _installmentMovementRepository = installmentMovementRepository;
 }
 public HistogramController(ApiDataContext context, IFeatureRepository featureRepository, IBackgroundJobClient backgroundJobClient)
     : this(new HistogramRepository(context), new UserEventRepository(context), new GenerateFeatureDecorator<Histogram>(new GenerateHistogram(), featureRepository), featureRepository, backgroundJobClient)
 {
 }
Example #28
0
 public DarknetService(ILogger <DarknetService> logger,
                       IBackgroundJobClient backgroundJobs)
 {
     _logger         = logger;
     _backgroundJobs = backgroundJobs;
 }
Example #29
0
 public TestHangfireController(IBackgroundJobClient backgroundJob)
 {
     this.backgroundJob = backgroundJob;
 }
Example #30
0
 public EntityHooksService(
     IBackgroundJobClient backgroundJobClient,
     IServiceProvider serviceProvider
     ) : base(backgroundJobClient, serviceProvider)
 {
 }
Example #31
0
 public ContractTerminationController(IBackgroundJobClient jobClient)
 {
     _jobClient = jobClient;
 }
Example #32
0
 public TestHangfireController(IBackgroundJobClient backgroundJob)
 {
     this.backgroundJob = backgroundJob;
 }
Example #33
0
 public ApiController(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
        public static async Task <bool> HandlePatreonPledgeObject(PatreonObjectData?pledge, PatreonObjectData?user,
                                                                  string?rewardId, NotificationsEnabledDb database, IBackgroundJobClient jobClient)
        {
            if (pledge?.Attributes.AmountCents == null || user?.Attributes.Email == null)
            {
                throw new Exception("Invalid patron API object, missing key properties");
            }

            if (rewardId == null)
            {
                throw new Exception("Invalid patron API object, missing any reward id");
            }

            var pledgeCents = pledge.Attributes.AmountCents.Value;

            bool declined = !string.IsNullOrEmpty(pledge.Attributes.DeclinedSince);

            var email = user.Attributes.Email?.Trim();

            if (string.IsNullOrEmpty(email))
            {
                throw new Exception("Patron object has null email");
            }

            var patron = await database.Patrons.FirstOrDefaultAsync(p => p.Email == email);

            var username = user.Attributes.Vanity;

            if (string.IsNullOrWhiteSpace(username))
            {
                username = user.Attributes.FullName;
            }

            if (string.IsNullOrWhiteSpace(username))
            {
                // TODO: to resolve already used name conflicts the Id could be appended here
                username = user.Attributes.FirstName;
            }

            // Ensure no trailing spaces in patron names
            username = username?.Trim();

            if (string.IsNullOrWhiteSpace(username))
            {
                // Fallback to using the id if everything failed...
                username = $"Patron {user.Id}";
            }

            if (patron == null)
            {
                if (!declined)
                {
                    await database.LogEntries.AddAsync(new LogEntry()
                    {
                        Message = $"We have a new patron: {username}"
                    });

                    await database.Patrons.AddAsync(new Patron()
                    {
                        Username          = username,
                        Email             = email,
                        PledgeAmountCents = pledgeCents,
                        RewardId          = rewardId,
                        Marked            = true
                    });

                    return(true);
                }

                return(false);
            }

            patron.Marked = true;

            bool changes           = false;
            bool reapplySuspension = false;

            if (declined)
            {
                if (patron.Suspended != true)
                {
                    await database.LogEntries.AddAsync(new LogEntry()
                    {
                        Message = $"A patron ({patron.Id}) is now in declined state. Setting as suspended",
                    });

                    patron.Suspended       = true;
                    patron.SuspendedReason = "Payment failed on Patreon";
                    reapplySuspension      = true;

                    changes = true;
                }
            }
            else if (patron.RewardId != rewardId || patron.Username != username)
            {
                await database.LogEntries.AddAsync(new LogEntry()
                {
                    Message = $"A patron ({patron.Id}) has changed their reward or name",
                });

                patron.RewardId          = rewardId;
                patron.PledgeAmountCents = pledgeCents;
                patron.Username          = username;
                patron.Suspended         = false;
                reapplySuspension        = true;

                changes = true;
            }
            else if (patron.Suspended == true)
            {
                patron.Suspended  = false;
                reapplySuspension = true;

                changes = true;
            }

            if (reapplySuspension)
            {
                // Need to wait for this job as the changes aren't saved immediately
                jobClient.Schedule <CheckSSOUserSuspensionJob>(x => x.Execute(patron.Email, CancellationToken.None),
                                                               TimeSpan.FromSeconds(30));
            }

            return(changes);
        }
 public SendRequestConfirmationMessagesADayBeforeAnItineraryDate(AllReadyContext context, IBackgroundJobClient backgroundJob, ISmsSender smsSender)
 {
     this.context = context;
     this.backgroundJob = backgroundJob;
     this.smsSender = smsSender;
 }
 public SchedulerController(IMetadataContext context, IBackgroundJobClient backgroundJobClient, IPostNotificationSender postNotificationSender)
 {
     _context = context;
     _backgroundJobClient = backgroundJobClient;
     _postNotificationSender = postNotificationSender;
 }
Example #37
0
 public RequestApiController(IMediator mediator, IBackgroundJobClient backgroundjobClient)
 {
     this.backgroundjobClient = backgroundjobClient;
     this.mediator = mediator;
 }
 public SendRequestConfirmationMessagesADayBeforeAnItineraryDate(AllReadyContext context, IBackgroundJobClient backgroundJob, ISmsSender smsSender)
 {
     this.context       = context;
     this.backgroundJob = backgroundJob;
     this.smsSender     = smsSender;
 }
 public RegistrationController(ILogger <RegistrationController> logger, IRegistrationStatus configuration,
                               ITokenVerifier csrfVerifier, NotificationsEnabledDb database, IBackgroundJobClient jobClient)
 {
     this.logger        = logger;
     this.configuration = configuration;
     this.csrfVerifier  = csrfVerifier;
     this.database      = database;
     this.jobClient     = jobClient;
 }
Example #40
0
 public ApiRequestProcessedNotificationHandler(AllReadyContext context, IBackgroundJobClient backgroundJobClient)
 {
     this.context             = context;
     this.backgroundJobClient = backgroundJobClient;
 }
Example #41
0
 public EntityFrameworkEventStore(EventsDbContext context, IBackgroundJobClient jobClient)
 {
     _context   = context;
     _jobClient = jobClient;
 }
Example #42
0
 public JobFactory(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
 public StoredQueriesExecutionJob(IBackgroundJobClient backgroundJobClient, ILogger <StoredQueriesExecutionJob> logger, IRemoteAppDataService appDataService)
 {
     _backgroundJobClient = backgroundJobClient;
     _logger         = logger;
     _appDataService = appDataService;
 }
 public DeleteFileEntryCommandHandler(IBackgroundJobClient jobClient, IAcornBoxDbContext dbContext)
 {
     _jobClient = jobClient;
     _dbContext = dbContext;
 }
Example #45
0
 public TaskProcessor(string connectionString, IBackgroundJobClient backgroundJobs)
 {
     _connectionString = connectionString;
     _backgroundJobs   = backgroundJobs;
     _taskDataService  = new FinanceAPIMongoDataService.DataService.TaskDataService(_connectionString);
 }
Example #46
0
 public DriftScheduler(IBackgroundJobClient backgroundJobs, DriftClientConfig driftConfig, ILogger <DriftScheduler> logger)
 {
     _backgroundJobs = backgroundJobs;
     _driftConfig    = driftConfig;
     _logger         = logger;
 }
Example #47
0
File: Jobs.cs Project: joaofx/Miru
 public Jobs(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
Example #48
0
 public ReportsController(IReportRunner reportRunner, IOptions <Config> configOptions, UloDbContext db, ICacher cacher, PortalHelpers portalHelpers, UserHelpers userHelpers, ILogger <ReportsController> logger, IRecurringJobManager rjm, IBackgroundJobClient backgroundJobClient)
     : base(db, cacher, portalHelpers, userHelpers, logger)
 {
     ReportRunner        = reportRunner;
     ConfigOptions       = configOptions;
     RJM                 = rjm;
     BackgroundJobClient = backgroundJobClient;
 }
 public ValuesController(IBackgroundJobClient backgroundJobClient)
 {
     _backgroundJobClient = backgroundJobClient;
 }
        public void Setup()
        {
            _client = Mock.Of<IBackgroundJobClient>();

            _context = Mock.Of<IMetadataContext>();
            _scheduledImages = Mock.Of<DbSet<ScheduledImage>>();

            _postNotificationSender = Mock.Of<IPostNotificationSender>();

            var imageMetadataTags = Mock.Of<DbSet<ImageMetadataTag>>();
            Mock.Get(_context).Setup(ctx => ctx.ScheduledImages).Returns(_scheduledImages);
            Mock.Get(_context).Setup(ctx => ctx.ImageMetadataTags).Returns(imageMetadataTags);
        }