public WebEventDocumentWriter(IIndexEventContainerDocumentFactory indexEventSplunkContractFactory,
                                      IWebEventDocumentFactory webEventDocumentFactory, IBackgroundWebEventsQueue backgroundWebEventsQueue)
        {
            IndexEventSplunkContractFactory = indexEventSplunkContractFactory
                                              ?? throw new ArgumentNullException(nameof(indexEventSplunkContractFactory));

            WebEventDocumentFactory = webEventDocumentFactory
                                      ?? throw new ArgumentNullException(nameof(webEventDocumentFactory));

            BackgroundWebEventsQueue = backgroundWebEventsQueue
                                       ?? throw new ArgumentNullException(nameof(backgroundWebEventsQueue));
        }
        public TrafficCometSaveEventTasksExecutorService(IBackgroundWebEventsQueue webEventsQueue,
                                                         IConfiguration configuration, IServiceProvider serviceProvider, IApplicationLifetime applicationLifetime,
                                                         ILogger <TrafficCometSaveEventTasksExecutorService> logger)
        {
            WebEventsQueue = webEventsQueue
                             ?? throw new ArgumentNullException(nameof(webEventsQueue));

            Configuration = configuration ??
                            throw new ArgumentNullException(nameof(configuration));

            ServiceProvider = serviceProvider
                              ?? throw new ArgumentNullException(nameof(serviceProvider));

            ApplicationLifetime = applicationLifetime
                                  ?? throw new ArgumentNullException(nameof(applicationLifetime));

            ApplicationLifetime.ApplicationStopping.Register(ApplicationStopping);

            Logger = logger
                     ?? throw new ArgumentNullException(nameof(logger));
        }