internal ElasticsearchLogShipper(ElasticsearchSinkState state)
        {
            _state = state;
            _connectionSchedule = new ExponentialBackoffConnectionSchedule(_state.Options.BufferLogShippingInterval ?? TimeSpan.FromSeconds(5));

            _batchPostingLimit   = _state.Options.BatchPostingLimit;
            _bookmarkFilename    = Path.GetFullPath(_state.Options.BufferBaseFilename + ".bookmark");
            _logFolder           = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(_state.Options.BufferBaseFilename) + "*.json";

            _timer = new Timer(s => OnTick());

            AppDomain.CurrentDomain.DomainUnload += OnAppDomainUnloading;
            AppDomain.CurrentDomain.ProcessExit  += OnAppDomainUnloading;

            SetTimer();
        }
        internal ElasticsearchLogShipper(ElasticsearchSinkState state)
        {
            _state = state;
            _connectionSchedule = new ExponentialBackoffConnectionSchedule(_state.Options.BufferLogShippingInterval ?? TimeSpan.FromSeconds(5));

            _batchPostingLimit   = _state.Options.BatchPostingLimit;
            _bookmarkFilename    = Path.GetFullPath(_state.Options.BufferBaseFilename + ".bookmark");
            _logFolder           = Path.GetDirectoryName(_bookmarkFilename);
            _candidateSearchPath = Path.GetFileName(_state.Options.BufferBaseFilename) + "*.json";

#if NO_TIMER
            _timer = new PortableTimer(cancel => OnTick());
#else
            _timer = new Timer(s => OnTick(), null, -1, -1);
#endif
            SetTimer();
        }