static void Main(string[] args)
        {
            // Get rid of compiler warnings by using the GenericResolver related variables.
            m_FeedStats          = new DataFeedStatistics();
            m_DataAnalysisResult = new IngestedDataAnalysisResult();

            Console.Title = m_ThisName;
            Console.WriteLine("{0}.Main(): Entered. Awaiting your input to start the", m_ThisName);
            Console.WriteLine("Service Host for the AdminManager and SomeManager");
            ConsoleNTraceHelpers.PauseTillUserPressesEnter();

            ServiceHost <AdminManager> adminHost       = null;
            ServiceHost <SomeManager>  someManagerHost = null;

            try
            {
                adminHost = new ServiceHost <AdminManager>();
                adminHost.Open();
                Console.WriteLine("{0}.Main():  Admin ServiceHost opened OK.", m_ThisName);

                someManagerHost = new ServiceHost <SomeManager>();
                someManagerHost.Open();
                Console.WriteLine("{0}.Main():  SomeManager ServiceHost opened OK.", m_ThisName);
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}.Main():  host.Open() Threw exception!\n     {1}", m_ThisName, ex);
            }
            Console.WriteLine("\n{0}.Main():  Press ENTER to EXIT.", m_ThisName);
            Console.ReadLine();
            CloseOrAbortHosts(adminHost, someManagerHost);
            Console.WriteLine("\n{0}.Main(): Exiting......", m_ThisName);
        }
        DataFeedStatistics IFeedAdminDA.GetFeedStatistics(string queueName)
        {
            Debug.Assert(!string.IsNullOrEmpty(queueName));
            DataFeedStatistics stats = m_FeedAdminRepository.GetFeedStatistics(queueName);

            return(stats);
        }
Exemple #3
0
 public DataFeedStatistics PresentFeedComponentInfo(string componentName)
 {
     // "Programming WCF Services", 3rd Edition by Juval Lowy
     // pp 258 - 259 recommends the form of implementing proxies like below.
     try
     {
         DataFeedStatistics stats = Channel.PresentFeedComponentInfo(componentName);
         return(stats);
     }
     catch (Exception)
     {
         Abort();
         throw;
     }
 }
        private static void DisplayQueueLength(string queueName)
        {
            Console.WriteLine("{0}.Main(): Getting queue length..", m_ThisName);
            DataFeedStatistics stats = PresentQueueStatistics(queueName);
            string             lengthMsg;

            if (stats != null)
            {
                lengthMsg = string.Format("{0}.Main(): Queue length = {1}", m_ThisName, stats.QueueLength);
            }
            else
            {
                lengthMsg = "Server return null.";
            }
            Console.WriteLine(lengthMsg);
        }
        private static DataFeedStatistics PresentQueueStatistics(string queueName)
        {
            DataFeedStatistics stats = null;
            FeedAdminClient    proxy = new FeedAdminClient("feedAdmin");

            try
            {
                stats = proxy.PresentFeedComponentInfo(queueName);
                proxy.Close();
            }
            catch (Exception ex)
            {
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".PresentQueueStatistics(): Exception!! ", ex);
                proxy.Abort();
            }
            return(stats);
        }
 DataFeedStatistics IFeedAdminRepos.GetFeedStatistics(string queueName)
 {
     try
     {
         DataFeedStatistics stats = new DataFeedStatistics();
         stats.FeedComponentName       = queueName;
         stats.StatsCollectionDateTime = DateTime.Now;
         QueueDescription queueDescr = iFX.Azure.AzureServiceBusHelpers.GetQueueDescription(queueName);
         stats.QueueLength           = queueDescr.MessageCount;
         stats.DeadLetterQueueLength = queueDescr.MessageCountDetails.DeadLetterMessageCount;
         return(stats);
     }
     catch (Exception ex)
     {
         ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".GetFeedStatistics()", ex);
         throw;
     }
 }
        DataFeedStatistics IFeedAdmin.PresentFeedComponentInfo(string componentName)
        {
            ConsoleNTraceHelpers.DisplayInfoToConsoleNTrace(m_ThisName + ".PresentFeedComponentInfo(): Entered:");

            // Check validity of all requests.
            IAdminValidityEngine validityEngProxy = InProcFactory.CreateInstance <ValidityEngine, IAdminValidityEngine>();

            validityEngProxy.IsPresentFeedComponentInfoRequestValid(componentName);
            InProcFactory.CloseProxy(validityEngProxy);

            // Retrieve Feed Component info
            DataFeedStatistics stats            = null;
            IFeedAdminDA       feedAdminDaProxy = InProcFactory.CreateInstance <AdminDA, IFeedAdminDA>();

            stats = feedAdminDaProxy.GetFeedStatistics(componentName);
            InProcFactory.CloseProxy(feedAdminDaProxy);

            return(stats);
        }
        private static void DisplayQueueStatistics(string queueName)
        {
            Console.WriteLine("{0}.Main(): Getting queue statistics..", m_ThisName);
            DataFeedStatistics stats   = PresentQueueStatistics(queueName);
            string             statMsg = string.Format("{0}.Main(): Queue statistics..", m_ThisName);

            Console.WriteLine(statMsg);
            if (stats != null)
            {
                statMsg =
                    string.Format("   queueName={0}, queueLength={1},\n   deadLetterQueueLength={2}, statsTime={3}",
                                  stats.FeedComponentName, stats.QueueLength,
                                  stats.DeadLetterQueueLength, stats.StatsCollectionDateTime);
            }
            else
            {
                statMsg = "Server return null.";
            }
            Console.WriteLine(statMsg);
        }