Пример #1
0
        static async Task Main(string[] args)
        {
            IJobService myJobService1 = JobManager.Scheduler()
                                        .ToRunOnceIn(3)
                                        .Seconds()
                                        .AtStartTime()
                                        .BuildJobService <MyJobGreen>();

            IJobService myJobService2 = JobManager.Scheduler()
                                        .ToRunOnceIn(1)
                                        .Seconds()
                                        .AtTheEndOfDay()
                                        .BuildJobService <MyJobRed>();

            IAsyncJobService asyncJobService = JobManager.Scheduler()
                                               .ToRunOnceIn(1)
                                               .Seconds()
                                               .AtStartTime()
                                               .BuildAsyncJobService <MyAsyncJob>();

            var cancellationTokenSource = new CancellationTokenSource();
            var token = cancellationTokenSource.Token;

            myJobService1.Start(token);
            myJobService2.Start(token);
            await asyncJobService.StartAsync(token);

            Thread.Sleep(15000);

            cancellationTokenSource.Cancel();
            cancellationTokenSource.Dispose();

            Console.ReadLine();
        }
Пример #2
0
 public MakePaymentConsumer(
     IAsyncJobService service,
     IBankProcessor processor,
     IPaymentRepository repository)
     : base(service)
 {
     _processor  = processor;
     _repository = repository;
 }
Пример #3
0
 public Handler(IAsyncJobService bus) => _bus = bus;
 protected CommandConsumer(IAsyncJobService service) => _service = service;
Пример #5
0
 public Handler(IAsyncJobService service, IMapper mapper)
 {
     _service = service;
     _mapper  = mapper;
 }