Ejemplo n.º 1
0
        public void TestMethod1()
        {
            BufferServiceManager.AddBufferProcessorService(new List <BufferProcessorService> {
                new  LogBufferProcessorService(), new SilverDollarBufferProcessorService()
            });
            BufferServiceManager.DispatcherService.Start();
            for (int i = 0; i < 10; i++)
            {
                System.Threading.Tasks.Task.Run(new Action(() =>
                {
                    BufferServiceManager.TransportService.Transport(new LogBufferItem {
                        Id = Guid.NewGuid(), Message = "测试_" + DateTime.Now
                    });
                }));
                System.Threading.Tasks.Task.Run(new Action(() =>
                {
                    BufferServiceManager.TransportService.Transport(new SilverDollarBufferItem {
                        Id = Guid.NewGuid(), SilverDollarName = "银元名称_" + DateTime.Now
                    });
                }));

                System.Threading.Thread.Sleep(TimeSpan.FromMilliseconds(500));
            }
            BufferServiceManager.DispatcherService.Stop();
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            var filters = GlobalFilters.Filters;

            filters.Add(new Ik.WebFramework.Mvc.RequestProcessHandleAttribute(true, true));
            filters.Add(new System.Web.Mvc.ValidateInputAttribute(false));
            var routes = RouteTable.Routes;

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );

            //ConfigManager.RemoteConfigService.ServiceException += RemoteConfigService_ServiceException;
            //ConfigManager.RemoteConfigService.Start();

            LogManager.Initialize();

            BufferServiceManager.AddBufferProcessorService(new List <BufferProcessorService> {
                new RequestToDataBase(OperationSupportDataAccessFactory.Instance)
            });

            BufferServiceManager.DispatcherService.ServiceException += DispatcherService_ServiceException;
            BufferServiceManager.DispatcherService.Start();


            SubscriptionManager.SubscriberContextInitialize();
            SubscriptionManager.PublisherContextInitialize();

            SubscriptionManager.DistributedEventService.ServiceException += DistributedEventService_ServiceException;

            SubscriptionManager.DistributedEventService.Start();

            IkAuthorizationContext.Initialize(() => new ItAdminIkAuthorization());

            ObjectEngineContext.Initialize(() => new IkWebMvcEngine());
        }