コード例 #1
0
        private void PollIbs(int pollingValue)
        {
            Log.Info("Queue OrderStatusJob " + DateTime.Now.ToString("HH:MM:ss"));

            var hasOrdersWaitingForPayment = false;

            Observable.Timer(TimeSpan.FromSeconds(pollingValue))
                .Subscribe(_ =>
                {
                    try
                    {
                        var serverProcessId = GetServerProcessId();
                        Trace.WriteLine("serverProcessId : " + serverProcessId);
                        var statusJobService = UnityContainerExtensions.Resolve<IUpdateOrderStatusJob>(UnityServiceLocator.Instance);
                        hasOrdersWaitingForPayment = statusJobService.CheckStatus(serverProcessId, pollingValue);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                    }
                    finally
                    {
                        PollIbs(hasOrdersWaitingForPayment ? WaitingForPaymentPollingValue : _defaultPollingValue);
                    }
                });
        }
コード例 #2
0
        protected void Application_EndRequest(object sender, EventArgs e)
        {
            if (Request.Path.Contains(@"/api/"))
            {
                if (HttpContext.Current.Items["RequestLoggingWatch"] is Stopwatch)
                {
                    var watch = (Stopwatch)HttpContext.Current.Items["RequestLoggingWatch"];
                    watch.Stop();

                    var config = UnityContainerExtensions.Resolve<IServerSettings>(UnityServiceLocator.Instance);
                    Log.Info(string.Format("[{2}] Request info : {0} completed in {1}ms ", Request.Path,
                        watch.ElapsedMilliseconds, config.ServerData.TaxiHail.ApplicationKey));
                }
            }
        }
コード例 #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            XmlConfigurator.Configure();
            new MkWebAppHost().Init();

            var config = UnityContainerExtensions.Resolve<IServerSettings>(UnityServiceLocator.Instance);
            BundleConfig.RegisterBundles(BundleTable.Bundles, config.ServerData.TaxiHail.ApplicationKey);

            var serverSettings = UnityContainerExtensions.Resolve<IServerSettings>(UnityServiceLocator.Instance);

            _defaultPollingValue = serverSettings.ServerData.OrderStatus.ServerPollingInterval;
            PollIbs(_defaultPollingValue);

            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        }
コード例 #4
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            if (_firstRequest)
            {
                var notificationService = UnityContainerExtensions.Resolve<INotificationService>(UnityServiceLocator.Instance);
                var appSettings = UnityContainerExtensions.Resolve<IServerSettings>(UnityServiceLocator.Instance);

                notificationService.SetBaseUrl(appSettings.ServerData.BaseUrl.HasValue()
                            ? new Uri(appSettings.ServerData.BaseUrl)
                            : new Uri(Request.Url, VirtualPathUtility.ToAbsolute("~")));

                appSettings.ServerData.Target = ResolveDeploymentTarget(Request.Url.Host);

                _firstRequest = false;
            }
            if (Request.Path.Contains(@"/api/"))
            {
                var watch = new Stopwatch();
                watch.Start();
                HttpContext.Current.Items.Add("RequestLoggingWatch", watch);
            }
        }