示例#1
0
        public OnDemandEventSSSBService(IServiceProvider services, ILogger <OnDemandEventSSSBService> logger, IScheduleManager scheduleManager)
        {
            try
            {
                this._services        = services;
                this._logger          = logger ?? throw new ArgumentNullException(nameof(logger));
                this._scheduleManager = scheduleManager ?? throw new ArgumentNullException(nameof(scheduleManager));
                this._startDateTime   = DateTime.Now;

                _sssbService = SSSBService.Create(this._services, (options) => { options.Name = ONDEMAND_EVENT_SERVICE_NAME; });
                _sssbService.OnStartedEvent += async() =>
                {
                    this._startDateTime = DateTime.Now;
                    await this.OnStarted(_sssbService.QueueName);
                };
                _sssbService.OnStoppedEvent += async() =>
                {
                    await this.OnStopped(_sssbService.QueueName);
                };
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ErrorHelper.GetFullMessage(ex));
                throw;
            }
        }
示例#2
0
        public PubSubSSSBService(Guid conversationGroup, IServiceProvider services, IPubSubHelper pubSubHelper, HeartBeatTimer heartBeatTimer, ILogger <PubSubSSSBService> logger)
        {
            try
            {
                this._conversationGroup = conversationGroup;
                this._services          = services;
                this._pubSubHelper      = pubSubHelper;
                this._heartBeatTimer    = heartBeatTimer;
                this._logger            = logger ?? throw new ArgumentNullException(nameof(logger));
                this._startDateTime     = DateTime.Now;

                _sssbService = SSSBService.Create(this._services, (options) => { options.ConversationGroup = conversationGroup; options.MaxReadersCount = 1; options.Name = PubSubHelper.SUBSCRIBER_SERVICE_NAME; });
                _sssbService.OnStartedEvent += async() =>
                {
                    this._startDateTime = DateTime.Now;
                    await this.OnStarted(_sssbService.QueueName);
                };
                _sssbService.OnStoppedEvent += async() =>
                {
                    await this.OnStopped(_sssbService.QueueName);
                };
            }
            catch (Exception ex)
            {
                _logger.LogCritical(ErrorHelper.GetFullMessage(ex));
                throw;
            }
        }
示例#3
0
 public OnDemandTaskSSSBService(IServiceProvider services, ILogger <OnDemandTaskSSSBService> logger, IOptions <SSSBOptions> options)
 {
     try
     {
         this._services      = services;
         this._logger        = logger ?? throw new ArgumentNullException(nameof(logger));
         this._options       = options ?? throw new ArgumentNullException(nameof(options));
         this._startDateTime = DateTime.Now;
         int maxDOP = this._options.Value.MaxDOP[nameof(OnDemandTaskSSSBService)];
         _sssbService = SSSBService.Create(this._services, (options) => {
             options.MaxReadersCount = maxDOP;
             options.Name            = ONDEMAND_TASK_SERVICE_NAME;
         }
                                           );
         _sssbService.OnStartedEvent += async() =>
         {
             this._startDateTime = DateTime.Now;
             await this.OnStarted(_sssbService.QueueName);
         };
         _sssbService.OnStoppedEvent += async() =>
         {
             await this.OnStopped(_sssbService.QueueName);
         };
     }
     catch (Exception ex)
     {
         _logger.LogCritical(ErrorHelper.GetFullMessage(ex));
         throw;
     }
 }