コード例 #1
0
 ///<summary>
 /// Get this configuration set from a specific config file
 ///</summary>
 public static QuickBloxIntegrationConfiguration Load(string path, params Assembly[] assemblyContainingEvents)
 {
     if ((object)instance == null)
     {
         ExeConfigurationFileMap configMap = new ExeConfigurationFileMap() { ExeConfigFilename = path };
         Configuration config = ConfigurationManager.OpenMappedExeConfiguration(configMap, ConfigurationUserLevel.None);
         if (config.Sections["quickbloxintegration"] == null)
             return null;
         else
         {
             instance = (QuickBloxIntegrationConfiguration)config.Sections["quickbloxintegration"];
             BuildMappings(assemblyContainingEvents);
         }
     }
     return instance;
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Elders/Experiments
        static void Main(string[] args)
        {
            new Statsd(new XmlConfiguration());
            quickbloxCfg = QuickBloxIntegrationConfiguration.Load(Assembly.GetAssembly(typeof(TextMessageSent)));
            var sf = BuildQuickBloxSessionFactory();
            var session = sf.GetCurrentSession();

            var stats = (from txt in session.Query<IQuickBloxCustomObject>(typeof(TextMessageSent))
                         where txt.Created_at >= DateTime.Now.AddDays(-1).ToUnixTimestamp() && txt.Created_at <= DateTime.Now.ToUnixTimestamp()
                         orderby txt.Created_at descending
                         select txt as IQuickBloxCustomObject)
                        .Take(100)
                        .Skip(0);

            var expre = ((IQuery<IQuickBloxCustomObject>)stats);

            var result = stats.ToList();
            Console.ReadLine();
        }
コード例 #3
0
        static bool TryLoadConfig(string config, out QuickBloxIntegrationConfiguration hyperionConfiguration, params Assembly[] assemblyContainingEvents)
        {
            hyperionConfiguration = null;

            if (File.Exists(config))
                hyperionConfiguration = Load(config, assemblyContainingEvents);

            return hyperionConfiguration != null;
        }
コード例 #4
0
        public static void Boot()
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();
                log.Debug("[QuickBlox] - log4net was configured.");

                LoadConnectionStringAndDatabaseName();
                log.DebugFormat("[QuickBlox] - Connection string loaded: '{0}'.", connectionString);

#if DEBUG
                DatabaseManager.DeleteDatabase(connectionString);
                Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "stop_app");
                Thread.Sleep(1000);
                Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "reset");
                Thread.Sleep(1000);
                Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "start_app");
                Thread.Sleep(1000);
#endif

                isNewInstance = CreateDatabaseIfNotExists();
                log.Debug("[QuickBlox] - Database initialized.");

                protoregSerializer = BuildProtoregSerializer();
                log.Debug("[QuickBlox] - Protoreg Serializer was configured.");

                nhSessionFactory = BuildNHibernateSessionFacotory();
                log.Debug("[QuickBlox] - NHibernate SessionFactory was configured.");

                if (isNewInstance)
                {
                    log4net.Config.XmlConfigurator.Configure();
                    log.Debug("[QuickBlox] - log4net was configured.");
                }

                new Statsd(new XmlConfiguration());
                log.Debug("[QuickBlox] - StatsD was configured.");

                quickbloxCfg = QuickBloxIntegrationConfiguration.Load(Assembly.GetAssembly(typeof(TextMessageSent)));
                log.Debug("[QuickBlox] - QuickBloxIntegration was configured.");

                qbSessionFacotry = BuildQuickBloxSessionFactory();
                log.Debug("[QuickBlox] - QuickBloxSessionFactory was configured.");

                messageBus = BuildMessageBus();
                log.Debug("[QuickBlox] - MassTransit MessageBus was configured.");

                marketVisionQueue = new PersistentEventSource(PersistentEventSource.ProjectionsQueueName, protoregSerializer);

                eventStoreRecievingBus = BuildEventStoreMessageBus();
                log.Debug("[QuickBlox] - EventStore ConsumingBus was configured.");

                quickBloxCrawler = BuildQuickBloxCrawler();
                log.Debug("[QuickBlox] - QuickBloxCrawler was configured.");
            }
            catch (Exception ex)
            {
                log.Fatal("[QuickBlox] - Cannot boot the service", ex);
                throw ex;
            }
        }