コード例 #1
0
        public WorkerInvoker(
            IJobRepository jobRepository,
            IOptions <WorkerConfiguration <TWorker> > workerConfiguration,
            ISerializer <TInput> inputSerializer,
            ISerializer <TOutput> outputSerializer,
            IJobQueue jobQueue,
            IWorkerScopeFactory scopeFactory,
            ILogger <WorkerInvoker <TWorker, TInput, TOutput> > logger)
        {
            _logger              = logger;
            _jobRepository       = jobRepository;
            _workerConfiguration = workerConfiguration.Value;
            _inputSerializer     = inputSerializer;
            _outputSerializer    = outputSerializer;
            _jobQueue            = jobQueue;
            _scopeFactory        = scopeFactory;

            _consumer            = _jobQueue.GetConsumer(CreateQueueConfiguration());
            _consumer.JobQueued += OnNewJob;
            _consumer.Error     += OnError;
        }