Exemple #1
0
        /// <summary>
        /// Retireves the configuration record assocated with
        /// given sql, database, schema and queue. Then returns
        /// the application monitor associated with the
        /// configuration record.
        /// </summary>
        /// <param name="sqlServer"></param>
        /// <param name="database"></param>
        /// <param name="schema"></param>
        /// <param name="queue"></param>
        /// <returns>true if the notification was successfully processed</returns>
        public bool ProcessNotification(
            string sqlServer,
            string database,
            string schema,
            string queue)
        {
            lock (this)
            {
                int i;

                for (i = 0; i < 16; i++)
                {
                    string sqlServerCur = sqlServer;
                    if ((i & 8) == 8)
                    {
                        sqlServerCur = "";
                    }

                    string databaseCur = database;
                    if ((i & 4) == 4)
                    {
                        databaseCur = "";
                    }

                    string schemaCur = schema;
                    if ((i & 2) == 2)
                    {
                        schemaCur = "";
                    }

                    string queueCur = queue;
                    if ((i & 1) == 1)
                    {
                        queueCur = "";
                    }

                    string key = GetKey(sqlServerCur, databaseCur, schemaCur, queueCur);

                    if (m_configRT.ContainsKey(key))
                    {
                        ApplicationMonitor appMonitor =
                            Global.AppMonitorMgr.GetApplicationMonitor(sqlServerCur, databaseCur, schemaCur, queueCur);
                        if (appMonitor != null)
                        {
                            appMonitor.ActivateProcess(sqlServer, database, schema, queue);
                        }
                        return(true);
                    }
                }
            }
            return(false);
        }