Exemple #1
0
        public void Distribute(int publicationItemID)
        {
            BLL.DistributionHub.IDistributionHub distributionHub = InProcFactory.CreateInstance <BLL.DistributionHub.DistributionHub, BLL.DistributionHub.IDistributionHub>();

            try
            {
                Entities.PublicationEntities.PublicationItem publicationItem = distributionHub.PopulatePublicationItem(publicationItemID);

                HelperClasses.Output.ThrowIfFailed(publicationItem != null, string.Format("Could not load item {0}", publicationItemID.ToString()));

                bool isItemPublishable = distributionHub.IsItemPublishable(publicationItem);

                if (isItemPublishable)
                {
                    publicationItem.Status = 1;
                    HelperClasses.Output.ThrowIfFailed(distributionHub.SaveItem(publicationItem), string.Format("Could not set queued status for item {0} published status.", publicationItemID.ToString()));

                    HelperClasses.Output.ThrowIfFailed(PublishIt(publicationItemID), string.Format("Could not stream to destination: {0}", publicationItemID.ToString()));

                    publicationItem.Status = 2;
                    HelperClasses.Output.ThrowIfFailed(distributionHub.SaveItem(publicationItem), string.Format("Could not set item {0} published status.", publicationItemID.ToString()));
                }
            }
            catch (Exception ex)
            {
                HelperClasses.Output.ThrowIfFailed(false, ex.Message);
            }
            finally
            {
                InProcFactory.CloseProxy(distributionHub);
            }

            //Life is good, so let the transaction commit and be published.
        }
Exemple #2
0
        // Note how the DataFeedManager service composes other services. The Engine and DataAccessor
        // services are hosted and run "in process" to this DataFeedManager service via
        // the ServiceModelEx InProcFactory. Please see "Programming WCF Services", 3rd Edition
        // by Juval Lowy, pp 71-74 for more information.

        void IDataFeeds.IngestTestData(TestMessage msg)
        {
            DateTime msgReceivedTime = DateTime.Now;

            Debug.Assert(msg != null);

            //string displayMsg = string.Format("{0}.IngestTestData(): Entered:", m_ThisName);
            //ConsoleNTraceHelpers.DisplayInfoToConsoleNTrace(displayMsg);

            // Check validity.
            InProcessFeedMsg    checkedMsg       = null;
            IFeedValidityEngine validityEngProxy = InProcFactory.CreateInstance <ValidityEngine, IFeedValidityEngine>();

            checkedMsg = validityEngProxy.IsTestMessageValid(msg, msgReceivedTime);
            InProcFactory.CloseProxy(validityEngProxy);

            Debug.Assert(checkedMsg != null);
            if (checkedMsg.IsValid)
            {
                // Used only with a test client.
                DisplayMsgAndQueueLength(msg, checkedMsg);

                // Save data.
                IIngestedDataDA ingestDataDaProxy = InProcFactory.CreateInstance <IngestedDataDA, IIngestedDataDA>();
                ingestDataDaProxy.SaveTestData(checkedMsg);
                InProcFactory.CloseProxy(ingestDataDaProxy);
            }
            else
            {
                Debug.Assert(checkedMsg.IsValid);
                LogInvalidMessageError(checkedMsg);
            }
        }
Exemple #3
0
        public ApplicationTenantsResult GetApplicationTenants(ApplicationTenantsQuery query)
        {
            var repositoryService = InProcFactory.CreateInstance <ApplicationRepositoryService, IApplicationRepository>();

            try
            {
                return(repositoryService.GetApplicationTenants(query));
            }
            finally
            {
                InProcFactory.CloseProxy(repositoryService);
            }
        }
Exemple #4
0
        public ApplicationInfo[] GetApplications()
        {
            var repositoryService = InProcFactory.CreateInstance <ApplicationRepositoryService, IApplicationRepository>();

            try
            {
                return(repositoryService.GetApplications());
            }
            finally
            {
                InProcFactory.CloseProxy(repositoryService);
            }
        }
Exemple #5
0
        private void UseRepository(Action <IApplicationRepository> action)
        {
            var repositoryService = InProcFactory.CreateInstance <ApplicationRepositoryService, IApplicationRepository>();

            try
            {
                action(repositoryService);
            }
            finally
            {
                InProcFactory.CloseProxy(repositoryService);
            }
        }
Exemple #6
0
        private static void DisplayMsgAndQueueLength(TestMessage msg, InProcessFeedMsg checkedMsg)
        {
            // For test client only.
            IFeedAdminDA feedAdminDaProxy = InProcFactory.CreateInstance <AdminDA, IFeedAdminDA>();
            long         queueLength      = feedAdminDaProxy.GetQueueLength(iFX.Common.ConstantsNEnums.IngestionQueueName);

            InProcFactory.CloseProxy(feedAdminDaProxy);
            checkedMsg.QueueLength = queueLength;
            string queueLengthMsg = string.Format("{0} count = {1}",
                                                  iFX.Common.ConstantsNEnums.IngestionQueueName,
                                                  queueLength);

            ConsoleNTraceHelpers.DisplayInfoToConsoleNTrace(queueLengthMsg);
            ConsoleNTraceHelpers.DisplayTestMessage(msg);
            ConsoleNTraceHelpers.TraceTestMessage(msg);
        }
Exemple #7
0
        IngestedDataAnalysisResult ISomeDataAnalysisEngine.DoIngestedDataAnalysis()
        {
            // Get the ingested data from the DB.
            IIngestedDataDA ingestDataDaProxy    = InProcFactory.CreateInstance <IngestedDataDA, IIngestedDataDA>();
            string          dummyDataForAnalysis = ingestDataDaProxy.GetDummyDataForAnalysis();

            // Do the analysis.
            IngestedDataAnalysisResult result = new IngestedDataAnalysisResult();

            InProcFactory.CloseProxy(ingestDataDaProxy);
            result.ResultPart1 = dummyDataForAnalysis;
            int analysisResult = dummyDataForAnalysis.Length;

            result.ResultPart2 =
                string.Format("The analysis of the dummy data reveals it contains {0} characters", analysisResult);
            return(result);
        }
        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);
        }
Exemple #9
0
        protected void UpdateTenant(string applicationName, string tenantName, Action <ApplicationTenantHeaderUpdateInfo> updateInfo)
        {
            if (string.IsNullOrEmpty(applicationName))
            {
                throw new ArgumentNullException("applicationName");
            }
            if (string.IsNullOrEmpty(tenantName))
            {
                throw new ArgumentNullException("tenantName");
            }

            var repositoryService = InProcFactory.CreateInstance <ApplicationRepositoryService, IApplicationRepository>();

            try
            {
                var tenant = repositoryService.GetTenantHeaderInfo(applicationName, tenantName);
                if (tenant == null)
                {
                    throw new ArgumentException(string.Format("Tenant {0} from application {1} could not be found.", tenantName, applicationName));
                }

                var tenantUpdateInfo = new ApplicationTenantHeaderUpdateInfo()
                {
                    ApplicationName   = applicationName,
                    Name              = tenantName,
                    IsActive          = tenant.IsActive,
                    ContractStartTime = tenant.ContractStartedAt,
                    Url = tenant.Url
                };

                updateInfo(tenantUpdateInfo);

                repositoryService.UpdateTenantHeaderInfo(tenantUpdateInfo);
            }
            finally
            {
                InProcFactory.CloseProxy(repositoryService);
            }
        }
Exemple #10
0
 public void Close()
 {
     InProcFactory.CloseProxy(Proxy);
 }
Exemple #11
0
 void IDisposable.Dispose()
 {
     InProcFactory.CloseProxy(Proxy);
 }