Example #1
0
        void IIngestedRepos.SaveTestData(InProcessFeedMsg msg)
        {
            TestDataEntity msgEntity  = null;
            string         moreExInfo = string.Empty;

            try
            {
                msgEntity = MakeTestDataEntity(msg);

                // TODO 5-23-15 Failsafe requires using Transient Fault application block and
                // maybe circuit breaker pattern on all requests for cloud services.  Wrap below
                // code in that stuff as an example.
                AzureStorageHelpers.AzTableStorageInsert(ConstantsNEnums.TestMessageTableName, msgEntity);
            }
            catch (StorageException ex)
            {
                if (ex.Message.Contains("409"))
                {
                    moreExInfo = "\n HTTP 409 error code: RowKey already exists in table on insert.";
                }
                string displayMsg = string.Format("\n{0}.SaveTestData():", m_ThisName);
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(displayMsg, ex);
                ConsoleNTraceHelpers.DisplayInfoToConsoleNTrace(moreExInfo);
                throw;
            }
            catch (Exception ex)
            {
                string displayMsg = string.Format("\n{0}.SaveTestData():", m_ThisName);
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(displayMsg, ex);
                throw;
            }
        }
 long IFeedAdminRepos.GetQueueLength(string queueName)
 {
     try
     {
         QueueDescription queueDescr = iFX.Azure.AzureServiceBusHelpers.GetQueueDescription(queueName);
         long             count      = queueDescr.MessageCount;
         return(count);
     }
     catch (Exception ex)
     {
         ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".GetQueueLength()", ex);
         throw;
     }
 }
        private static IngestedDataAnalysisResult AnalyzeIngestedData()
        {
            IngestedDataAnalysisResult result = null;
            SomeDataAnalysisClient     proxy  = new SomeDataAnalysisClient("someDataAnalysis");

            try
            {
                result = proxy.AnalyzeIngestedData();
                proxy.Close();
            }
            catch (Exception ex)
            {
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".AnalyzeIngestedData(): Exception!! ", ex);
                proxy.Abort();
            }
            return(result);
        }
        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;
     }
 }
Example #6
0
        private static void IngestTestData(TestMessage msg, string queueName)
        {
            // Allow calculation of elapsed time: From proxy instantiation
            // till the message is received by the instantiated service instance.
            msg.MessageSendDateTime = DateTime.Now;

            // "Programming WCF Services" 3rd edition by Juval Lowy pp 259-260 recommends the
            // following form when needing to catch exceptions near the SendQueuedTestMessage().
            DataFeedsClient proxy = new DataFeedsClient(queueName);

            try
            {
                proxy.IngestTestData(msg);
                proxy.Close();
                Console.WriteLine("{0}.IngestTestData(): Test message enqueued Ok.", m_ThisName);
                ConsoleNTraceHelpers.DisplayTestMessage(msg);
            }
            catch (Exception ex)
            {
                ConsoleNTraceHelpers.DisplayExToConsoleNTrace(m_ThisName + ".IngestTestData(): ", ex);
                proxy.Abort();
            }
        }