void CreateDirectoryMonitor() { var message = new CreateShelfService("TopShelf.DirectoryMonitor", ShelfType.Internal, typeof(DirectoryMonitorBootstrapper)); _serviceChannel.Send(message); }
void OnCreateShelfService(CreateShelfService message) { _log.InfoFormat("[Topshelf] Create Shelf Service: {0}{1}", message.ServiceName, message.BootstrapperType == null ? "" : " ({0})".FormatWith(message.BootstrapperType.ToShortTypeName())); ActorFactory <IServiceController> factory = _controllerFactory.CreateFactory(inbox => { IServiceController controller = new ShelfServiceController(inbox, message.ServiceName, this, message.ShelfType, message.BootstrapperType, message.AssemblyNames); _serviceCache.Add(message.ServiceName, controller); return(controller); }); ActorInstance instance = factory.GetActor(); _actorCache.Add(message.ServiceName, instance); instance.Send(new CreateService(message.ServiceName)); }