public WorkerScheduled(string queueName, int batchSize, IJobServiceScopeFactory scopeFactory, IJobLogger <WorkerScheduled> logger) : base(queueName, batchSize, 1, true, scopeFactory, logger) { _timeProvider = ServiceScope.GetRequiredService <ITimeProvider>(); _timer = ServiceScope.GetRequiredService <ITimer>(); _timer.TimeElapsed += CheckScheduledJobs; _scheduledJobs = new ConcurrentDictionary <ulong, JobInfo>(); _periodicJobs = new ConcurrentDictionary <string, ulong>(); _periodicSkipJobs = new ConcurrentDictionary <string, ConcurrentBag <ulong> >(); }
protected Worker(string queueName, int batchSize, int masMaxDegreeOfParallelism, bool singleActiveConsumer, IJobServiceScopeFactory serviceScopeFactory, IJobLogger <Worker> logger) : base(batchSize, logger) { ServiceScopeFactory = serviceScopeFactory; ServiceScope = ServiceScopeFactory.CreateScope(); _maxDegreeOfParallelism = masMaxDegreeOfParallelism; _singleActiveConsumer = singleActiveConsumer; _messageConsumer = ServiceScope.GetRequiredService <IMessageConsumer>(); QueueName = queueName; }
public SqlServerMessageReceiver(string queueName, bool singleActiveConsumer, IJobServiceScopeFactory scopeFactory, IJobLogger <SqlServerMessageReceiver <TDbContext> > logger) { _scopeFactory = scopeFactory; _scope = scopeFactory.CreateScope(); _queueName = queueName; _singleActiveConsumer = singleActiveConsumer; _sqlDialect = _scope.GetRequiredService <ISqlDialect>(); _timeProvider = _scope.GetRequiredService <ITimeProvider>(); _logger = logger; _instanceName = $"{Environment.MachineName}/{Guid.NewGuid()}"; _timer = _scope.GetRequiredService <ITimer>(); _timer.TimeElapsed += TimerCallback; }
public WorkerCoordinator(IJobServiceFactory serviceFactory, IJobLogger <WorkerCoordinator> logger = null) { ServiceScopeFactory = serviceFactory.GetRequiredService <IJobServiceScopeFactory>(); ServiceScope = ServiceScopeFactory.CreateScope(); _settings = ServiceScope.GetRequiredService <MassiveJobsSettings>(); _reconnectTimer = ServiceScope.GetRequiredService <ITimer>(); _reconnectTimer.TimeElapsed += Reconnect; Workers = new List <IWorker>(); Logger = logger ?? ServiceScope.GetRequiredService <IJobLogger <WorkerCoordinator> >(); MessageConsumer = ServiceScope.GetRequiredService <IMessageConsumer>(); MessageConsumer.Disconnected += MessageBrokerDisconnected; }
public WorkerImmediate(string queueName, int batchSize, int maxDegreeOfParallelism, IJobServiceScopeFactory scopeFactory, IJobLogger <WorkerImmediate> logger) : base(queueName, batchSize, maxDegreeOfParallelism, false, scopeFactory, logger) { }
#pragma warning restore 0067 public SqlServerMessageConsumer(IJobServiceScopeFactory serviceScopeFactory, IJobLoggerFactory jobLoggerFactory) { _serviceScopeFactory = serviceScopeFactory; _jobLoggerFactory = jobLoggerFactory; }