Esempio n. 1
0
        public QueueManager(BatchingLogAgent LogAgent)
        {
            logAgent   = LogAgent;
            dataClient = logAgent.Configuration.BatchAgent;

            QueuePollingInterval = logAgent.Configuration.QueuePollingInterval;

            failedSendCount = 0;
            sendCount       = 0;
#if SILVERLIGHT
            pollingTimer = new Timer(pollingTimer_Tick, null, QueuePollingInterval, QueuePollingInterval);
#else
            pollingTimer = ThreadPoolTimer.CreatePeriodicTimer(pollingTimer_Tick, QueuePollingInterval);
#endif
        }
 /// <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;
 }
Esempio n. 3
0
        /// <summary>
        /// Cleans up the queue manager
        /// </summary>
        public void Dispose()
        {
            lock (this)
            {
#if SILVERLIGHT
                pollingTimer.Dispose();
#else
                pollingTimer.Cancel();
#endif
                pollingTimer = null;
            }
            BatchToRetry = null;
            logAgent     = null;
            dataClient   = null;
        }
Esempio n. 4
0
        internal static BatchingConfig Load(XmlReader reader)
        {
            BatchingConfig result     = null;
            IBatchAgent    batchAgent = null;

            reader.GoToElement();
            if (reader.LocalName != "Configuration")
            {
                throw new Exception("Invalid config Xml");
            }
            reader.ReadStartElement();
            if (!reader.IsEmptyElement)
            {
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                    case "BatchingConfig":
                        result = BatchingConfig.Load(reader);
                        break;

                    case "Service":
                        batchAgent = BatchAgentFactory.Load(reader);
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Skip();
            }

            if (result == null || batchAgent == null)
            {
                throw new Exception("Invalid Configuraiton");
            }
            result.BatchAgent = batchAgent;
            return(result);
        }
        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
            }
        }
 public RemoteVideoLogAgent(Uri configUri, IBatchAgent batchAgent)
     : base(configUri, batchAgent)
 { }
Esempio n. 8
0
        public static IBatchAgent Load(XmlReader reader)
        {
            IBatchAgent result = null;

            reader.GoToElement();

            if (!reader.IsEmptyElement)
            {
                string url = null;
                SerializationFormat serializationFormat = SerializationFormat.Unknown;
                bool isRelative         = false;
                bool isWCF              = true;
                bool binaryBinding      = false;
                bool compress           = false;
                int  maxOpenTimeSeconds = 5;
                int  maxSendTimeSeconds = 5;
                int  maxRecvTimeSeconds = 5;
                int  serviceVersion     = 3;

                reader.ReadStartElement();
                while (reader.GoToSibling())
                {
                    switch (reader.LocalName)
                    {
                    case "Url":
                        url = reader.ReadElementContentAsString();
                        break;

                    case "WCF":
                        isWCF = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "relative":
                        isRelative = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "binaryBinding":
                        binaryBinding = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "maxOpenTimeSeconds":
                        maxOpenTimeSeconds = reader.ReadElementContentAsInt();
                        break;

                    case "maxSendTimeSeconds":
                        maxSendTimeSeconds = reader.ReadElementContentAsInt();
                        break;

                    case "maxRecvTimeSeconds":
                        maxRecvTimeSeconds = reader.ReadElementContentAsInt();
                        break;

                    case "version":
                        serviceVersion = reader.ReadElementContentAsInt();
                        break;

                    case "compression":
                        compress = Convert.ToBoolean(reader.ReadElementContentAsInt());
                        break;

                    case "serializationFormat":

                        var value = reader.ReadElementContentAsString();

                        if (value.Equals("xml", StringComparison.OrdinalIgnoreCase))
                        {
                            serializationFormat = SerializationFormat.Xml;
                        }
                        else if (value.Equals("json", StringComparison.OrdinalIgnoreCase))
                        {
                            serializationFormat = SerializationFormat.Json;
                        }
                        else if (value.Equals("httpquerystring", StringComparison.OrdinalIgnoreCase))
                        {
                            serializationFormat = SerializationFormat.HttpQueryString;
                        }

                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                reader.ReadEndElement();

                // actually create the Uri
                Uri serviceUri = null;
                if (url != null)
                {
                    if (isRelative)
#if SILVERLIGHT && !WINDOWS_PHONE
                    { serviceUri = new Uri(System.Windows.Application.Current.Host.Source, url); }
#else
                    { throw new NotImplementedException(); }
#endif
                    else
                    {
                        serviceUri = new Uri(url);
                    }
                }

                if (isWCF)
                {
                    throw new NotImplementedException();
                    //TODO: result = new WCFDataClient(serviceUri, binaryBinding, maxOpenTimeSeconds, maxSendTimeSeconds, maxRecvTimeSeconds, serviceVersion);
                }
                else
                {
                    result = new RESTDataClient(serviceUri, maxSendTimeSeconds + maxRecvTimeSeconds, compress, serializationFormat, serviceVersion);
                }
            }
 /// <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 BatchingLogAgent(Uri configUri, IBatchAgent batchAgent)
     : this(configUri, true)
 {
     Configuration.BatchAgent = batchAgent;
 }
 public BatchingLogAgent(Uri configUri, IBatchAgent batchAgent)
     : this(configUri, true)
 {
     Configuration.BatchAgent = batchAgent;
 }
Esempio n. 12
0
 public RemoteVideoLogAgent(Uri configUri, IBatchAgent batchAgent)
     : base(configUri, batchAgent)
 {
 }