static SettingsStoreFactory()
        {
            //var configStore = ConfigurationManager.AppSettings["PPI.Store"];

            var configStore = StoreSection.Get().StoreNameOrType;

            Type storeImplementation = null;

            if (!string.IsNullOrEmpty(configStore))
            {
                storeImplementation = Type.GetType(configStore);
            }
            else
            {
                foreach (var store in DefaultStores)
                {
                    storeImplementation = Type.GetType(store);
                    if (storeImplementation != null)
                    {
                        break;
                    }
                }
            }

            //var storeImplementation= ??DefaultStore;

            try {
                _store = Activator.CreateInstance(storeImplementation);
            }
            catch (Exception e) {
                _eventLogger.LogException("Failed creating data store, using NullStore", e);
                _store = new NullStore();
            }
            //Bus.Buffer.SetPerformanceDataStore((IStorePerformanceData)_store);
        }
示例#2
0
 static void LogExceptions(string @event, Action code)
 {
     try {
         code();
     }
     catch (Exception e) {
         _logger.LogException(string.Format("Error raising {0}", @event), e);
     }
 }
        static Buffer()
        {
            var config = BufferSection.Get();

            _writeInterval = config.WriteInterval;
            if (config.MaxBufferSize >= 0)
            {
                _maxQueueSize = config.MaxBufferSize;
            }

            _store = SettingsStoreFactory.GetDataStorer();
            new Thread(() => {
                try {
                    StartReader();
                }
                catch (Exception e) {
                    _logger.LogException(string.Format("Error in queue runner thread, stopping execution"), e);
                }
            }).Start();
        }