Exemplo n.º 1
0
        protected override void Initialize()
        {
            lock (SQLLock)
            {
                if (isInitialized)
                {
                    return;
                }

                disabled = (bool)Message["disabled"].GetValueOrDefault(false);
                if (disabled)
                {
                    logger.LogInfo("SQL handler is disabled.");
                    return;
                }

                mongoDBHandler = ((MongoDBHandlerServer)handlerContainer.GetHandler("mongodbhandler"));
                database       = mongoDBHandler.Database;

                scheduledTimehh    = (int)Message["scheduledtime"]["hh"].GetValueOrDefault(01);
                scheduledTimemm    = (int)Message["scheduledtime"]["mm"].GetValueOrDefault(15);
                scheduledMs        = (scheduledTimehh * 60 + scheduledTimemm) * 60 * 1000;
                maxDailyRunMinutes = (int)Message["maxdailyrunminutes"].GetValueOrDefault(40); // max daily operational time


                isInitialized = true;

                if (cachingThread == null)
                {
                    cachingThread      = new Thread(RuncachingDaily);
                    cachingThread.Name = "SQL Handler SQL Thread";
                    cachingThread.Start();
                }
            }
        }
Exemplo n.º 2
0
        private void SetupEvents()
        {
            MongoDBHandlerServer mongoDbHandler = (MongoDBHandlerServer)handlerContainer.GetHandler(MongoDBHandlerConstants.mongodbhandler);

            if (mongoDbHandler == null)
            {
                throw new Exception("Mongo DB Handler not found");
            }

            mongoDbHandler.CreatingDocumentAfter += CreatingOrUpdatingDocumentAfter;
            mongoDbHandler.UpdatingDocumentAfter += CreatingOrUpdatingDocumentAfter;
        }