Пример #1
0
 public SlackService(ILogger <SlackService> logger,
                     ISlackBot bot,
                     IClock clock,
                     IMediator mediator,
                     ISubscriptionQueries subscriptionQueries,
                     IRateLimitQueries rateLimitQueries,
                     IAuthorizationQueries authorizationQueries,
                     IEventSubscriber eventSubscriber,
                     IApplicationEnder applicationEnder) : base(applicationEnder)
 {
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _bot                  = bot ?? throw new ArgumentNullException(nameof(bot));
     _clock                = clock ?? throw new ArgumentNullException(nameof(clock));
     _mediator             = mediator ?? throw new ArgumentNullException(nameof(mediator));
     _subscriptionQueries  = subscriptionQueries ?? throw new ArgumentNullException(nameof(subscriptionQueries));
     _rateLimitQueries     = rateLimitQueries ?? throw new ArgumentNullException(nameof(rateLimitQueries));
     _authorizationQueries = authorizationQueries ?? throw new ArgumentNullException(nameof(authorizationQueries));
     _eventSubscriber      = eventSubscriber ?? throw new ArgumentNullException(nameof(eventSubscriber));
     _retryPolicy          = Policy.Handle <Exception>(ex => ex.GetType() != typeof(TaskCanceledException))
                             .WaitAndRetryAsync(10, _ => TimeSpan.FromSeconds(2),
                                                (ex, time) =>
     {
         _logger.LogError(ex, "Exception during NATS connection. Waiting {Time}...", time);
     });
 }
Пример #2
0
 public DiscordCommands(ILogger <DiscordCommands> loggerService, IMediator mediator, ISubscriptionQueries subscriptionQueries, IRateLimitQueries rateLimitQueries, IAuthorizationQueries authorizationQueries, IClock clock)
 {
     _loggerService        = loggerService ?? throw new ArgumentNullException(nameof(loggerService));
     _mediator             = mediator ?? throw new ArgumentNullException(nameof(mediator));
     _subscriptionQueries  = subscriptionQueries ?? throw new ArgumentNullException(nameof(subscriptionQueries));
     _rateLimitQueries     = rateLimitQueries ?? throw new ArgumentNullException(nameof(rateLimitQueries));
     _authorizationQueries = authorizationQueries ?? throw new ArgumentNullException(nameof(authorizationQueries));
     _clock = clock ?? throw new ArgumentNullException(nameof(clock));
 }