public ReadGDSQueue(GDSServiceConfig _pServiceConfig, IRoboticsLogger _pRoboticsLogger, IMsgQProvider _pCloudLoggingQ)
        {
            _pcc         = _pServiceConfig.PCC;
            _qNumber     = _pServiceConfig.GalQNumber;
            _logPath     = _pServiceConfig.LocalLogPath;
            _serviceName = _pServiceConfig.ServiceName;
            _msgTemplate = _pServiceConfig.MsgTemplate;

            _roboticsLogger   = _pRoboticsLogger;
            _objCloudLoggingQ = _pCloudLoggingQ;

            _pnrMovementMsg = "PNR: {0}" + Environment.NewLine + string.Format(Constants.PNR_REMOVED_FROM_GAL_Q, _qNumber);

            _gdsPro = GDSFactory.GetGDSProvider(_pServiceConfig.GDSAuthDetail);

            if (!string.IsNullOrEmpty(_pServiceConfig.DestinationCloudQName))
            {
                _objDestinationCloudQ = CloudObjectFactory.GetMsgQProvider(_pServiceConfig.CloudProvider,
                                                                           _pServiceConfig.DestinationCloudQName,
                                                                           _pServiceConfig.ConnectionString);

                _pnrMovementMsg = _pnrMovementMsg + Environment.NewLine +
                                  string.Format(Constants.PNR_ADDED_TO_CLOUD_Q, _pServiceConfig.DestinationCloudQName);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            ReadGDSQueue objGDSQScanner = null;

            ///////Add settings in Azure table
            GDSServiceConfig objServiceConfig = new GDSServiceConfig();
            ///////Validate Configuration settings


            IRoboticsLogger objFileLogger = RoboticsLoggerFactory.GetRoboticsLogger(RoboticsLoggerEnum.FileLogger,
                                                                                    objServiceConfig.LocalLogPath, string.Empty, string.Empty);

            IMsgQProvider _objCloudLoggingQ = CloudObjectFactory.GetMsgQProvider(objServiceConfig.CloudProvider,
                                                                                 objServiceConfig.CloudLoggingQName,
                                                                                 objServiceConfig.ConnectionString);

            var logServiceStartMsg = LoggingMsgComposer.GetServiceStartLogMsg(objServiceConfig.ServiceName);

            _objCloudLoggingQ.AddMsgToLoggingQ(logServiceStartMsg);

            while (true)
            {
                try
                {
                    ///////read settings from Azure table and referesh the settings
                    objGDSQScanner = new ReadGDSQueue(objServiceConfig, objFileLogger, _objCloudLoggingQ);
                    objGDSQScanner.ScanGDSQueue();
                }
                catch (Exception ex)
                {
                    try
                    {
                        LogMsg logMsg = LoggingMsgComposer.GetLogMsg(RoboticsLogLevelEnum.Error,
                                                                     "Parent Block: " + Constants.OUTER_CATCH_BLOCK_ERROR_MSG + Environment.NewLine +
                                                                     ex.Message + Environment.NewLine + ex.StackTrace,
                                                                     objServiceConfig.ServiceName, objServiceConfig.GalQNumber);
                        _objCloudLoggingQ.AddMsgToLoggingQ(logMsg);
                    }
                    catch (Exception innerEx)
                    {
                        //LOG into local file
                        try
                        {
                            objFileLogger.WriteLog(RoboticsLogLevelEnum.Error,
                                                   LoggingMsgComposer.GetStringLogMsg("Parent Block: " + Constants.OUTER_CATCH_BLOCK_ERROR_MSG +
                                                                                      Environment.NewLine + innerEx.Message + Environment.NewLine + innerEx.StackTrace,
                                                                                      objServiceConfig.ServiceName, objServiceConfig.GalQNumber));
                        }
                        catch { /* SUPPRESS EXCEPTTION TO RESTART THE FLOW AFTER DELAY */ }
                    }
                }
                finally
                {
                    objGDSQScanner = null;
                }

                Thread.Sleep(1000 * objServiceConfig.DelayInterval);
            }
        }
示例#3
0
        public LogDumper(LoggingConfig _pConfig, IRoboticsLogger _pFileLogger)
        {
            _objFileLogger = _pFileLogger;
            _serviceName   = _pConfig.ServiceName;
            _objSumoLogger = RoboticsLoggerFactory.GetRoboticsLogger(BusinessEntities.Enum.RoboticsLoggerEnum.SumoLogger,
                                                                     string.Empty, _pConfig.SumoCollectionURL, _pConfig.SourceName);

            _objMsgQ = CloudObjectFactory.GetMsgQProvider(_pConfig.CloudProvider, _pConfig.CloudLoggingQName, _pConfig.ConnectionString);
        }