/// <summary>
 /// Cleans up the queue manager
 /// </summary>
 public void Dispose()
 {
     lock (this)
     {
         pollingTimer.Dispose();
         pollingTimer = null;
     }
     LogsToRetry = null;
     logAgent    = null;
     if (dataClient != null)
     {
         dataClient.LogBatchCompleted -= LogBatchCompleted;
     }
     dataClient = null;
 }
        public QueueManager(BatchingLogAgent LogAgent)
        {
            try
            {
                logAgent   = LogAgent;
                dataClient = logAgent.Configuration.BatchAgent;
                dataClient.LogBatchCompleted += LogBatchCompleted;

                state = QueueManagerStates.Uninitialized;
                QueuePollingInterval = logAgent.Configuration.QueuePollingInterval;

                failedSendCount = 0;
                sendCount       = 0;
                state           = QueueManagerStates.Polling;
                pollingTimer    = new System.Threading.Timer(pollingTimer_Tick, null, TimeSpan.FromSeconds(2), QueuePollingInterval);
            }
            catch
            {
                state = QueueManagerStates.Failed;
                throw;   // re-throw the error
            }
        }
        public QueueManager(BatchingLogAgent LogAgent)
        {
            try
            {
                logAgent = LogAgent;
                dataClient = logAgent.Configuration.BatchAgent;
                dataClient.LogBatchCompleted += LogBatchCompleted;

                state = QueueManagerStates.Uninitialized;
                QueuePollingInterval = logAgent.Configuration.QueuePollingInterval;

                failedSendCount = 0;
                sendCount = 0;
                state = QueueManagerStates.Polling;
                pollingTimer = new System.Threading.Timer(pollingTimer_Tick, null, TimeSpan.FromSeconds(2), QueuePollingInterval);
            }
            catch
            {
                state = QueueManagerStates.Failed;
                throw;   // re-throw the error
            }
        }
 /// <summary>
 /// Cleans up the queue manager
 /// </summary>
 public void Dispose()
 {
     lock (this)
     {
         pollingTimer.Dispose();
         pollingTimer = null;
     }
     LogsToRetry = null;
     logAgent = null;
     if (dataClient != null)
     {
         dataClient.LogBatchCompleted -= LogBatchCompleted;
     }
     dataClient = null;
 }