예제 #1
0
파일: EntileHost.cs 프로젝트: andlju/entile
        public static void RegisterModule(IEntileModule entileModule, IRegistrationStore registrationStore)
        {
            var moduleName = entileModule.ModuleName;

            IRegistrationStore store = registrationStore;
            if (store == null)
                store = new XmlFileRegistrationStore(moduleName);

            var registrator = new Registrator(store, entileModule.RemoteTileUriFormat);
            var notificationQueue = new InMemoryNotificationQueue();

            var notifier = new Notifier(registrator, notificationQueue);

            entileModule.Initialize(notificationQueue, registrator);

            RouteTable.Routes.Add(new ServiceRoute(moduleName + "/Registration", new EntileRegistrationServiceFactory(registrator, notificationQueue), typeof(RegistrationService)));
            RouteTable.Routes.Add(new ServiceRoute(moduleName, new EntileRegistrationServiceFactory(registrator, notificationQueue), entileModule.ServiceType));

            _notificationWorkerTimer = new Timer(a =>
                                                     {
                                                         try
                                                         {
                                                             notifier.DoWork();
                                                         }
                                                         catch(Exception ex)
                                                         {
                                                              /* Intentionally left blank. We don't want the IIS process to fail */
                                                             // TODO Implement logging
                                                         }

                                                         _notificationWorkerTimer.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(-1));
                                                     },
                                                     null,
                                                     TimeSpan.FromSeconds(1),
                                                     TimeSpan.FromMilliseconds(-1));
        }
예제 #2
0
 public Registrator(IRegistrationStore registrationStore, string remoteTileFormat)
 {
     _registrationStore = registrationStore;
     _remoteTileFormat = remoteTileFormat;
 }