public static IMiramarScheduleProvider ParseSchedule(IMiramarPublisher publisher, string path) { var visitor = new MiramarVisitor(); var parser = new MiramarSchedulingParser(visitor); return(parser.CreateScheduleProvider(publisher, path)); }
public static IMiramarTaskProvider ParseConfiguration(IMiramarPublisher publisher, string path) { var visitor = new MiramarVisitor(); var parser = new MiramarConfigurationParser(visitor); return(parser.CreateTaskProvider(publisher, path)); }
public MiramarController() { var connectionString = ConfigurationManager.ConnectionStrings["BillingAdmin"].ConnectionString; adminDataAccess = new AdminDataAccess(connectionString); logger = InfrastructureFactory.CreateLogger("Controller"); publisher = new MiramarPublisher(); allowMetaData = false; }
public MiramarScheduleProvider(TaskScheduleModel[] collection) { this.collection = new List <TaskScheduleModel>(collection); logger = InfrastructureFactory.CreateLogger("Scheduler"); publisher = new MiramarPublisher(); schedules = new Dictionary <string, DateTime>(); executionPlans = new Dictionary <string, List <string> >(); PushTasksForInitialConsideration(collection); }
public IMiramarScheduleProvider CreateScheduleProvider(IMiramarPublisher publisher, ExecutionElement element) { if (element == null) { return(new MiramarScheduleProvider(publisher, new TaskScheduleModel[0])); } var collection = element.ExecutionTypes .Select(CreateModel) .ToArray(); return(new MiramarScheduleProvider(publisher, collection)); }
public IMiramarTaskProvider CreateTaskProvider(IMiramarPublisher publisher, ConfigurationElement element) { if (element == null) { return(new MiramarTaskProvider(publisher, new TaskConfigurationModel[0])); } var collection = element.Tasks .Select(CreateModel) .ToArray(); return(new MiramarTaskProvider(publisher, collection)); }
public IMiramarScheduleProvider CreateScheduleProvider(IMiramarPublisher publisher, string path) { var fileInfo = new FileInfo(path); if (!fileInfo.Exists) { return(new MiramarScheduleProvider(publisher, new TaskScheduleModel[0])); } using (var stream = fileInfo.OpenRead()) { var document = XDocument.Load(stream); var element = visitor.VisitExecution(document); return(CreateScheduleProvider(publisher, element)); } }
protected override void OnStart(string[] args) { logger.Debug("Starting up service."); queueFactory = CreateMessageFactory(logger); if (!queueFactory.IsActive) { logger.InfoFormat("RabbitMQ is not active. Messaging will not be available."); } queuePublisher = new MiramarPublisher(queueFactory); var directory = AppDomain.CurrentDomain.BaseDirectory; var path = Path.Combine(directory, "miramar.config"); var contextProvider = new MiramarContextProvider(); var taskProvider = MiramarConfigurationParser.ParseConfiguration(queuePublisher, path); var scheduleProvider = MiramarSchedulingParser.ParseSchedule(queuePublisher, path); serviceTask = new Task(() => { logger.Info("Starting Miramar Controller."); var controller = new MiramarController(queuePublisher, taskProvider, scheduleProvider, contextProvider); controller.ThreadRun(serviceSource.Token); }); serviceTask.ContinueWith(x => logger.Info("Controller is shutting down.")); messageTask = new Task(() => { logger.Info("Starting Miramar Scheduler."); var scheduler = new ScheduleService(queueFactory, taskProvider, scheduleProvider, contextProvider); scheduler.ThreadRun(serviceSource.Token); }); messageTask.ContinueWith(x => logger.Info("Scheduler is shutting down.")); AddMiramarAdapter(queueFactory); serviceTask.Start(); messageTask.Start(); logger.Info("Miramar Controller is now running."); }
public MiramarScheduleProvider(IMiramarPublisher publisher, TaskScheduleModel[] collection) : this(collection) { this.publisher = publisher; }
public MiramarController(IMiramarPublisher publisher, IMiramarTaskProvider taskProvider, IMiramarScheduleProvider scheduleProvider, IMiramarContextProvider contextProvider, bool allowMetaData) : this(publisher, taskProvider, scheduleProvider, contextProvider) { this.allowMetaData = allowMetaData; }
public MiramarController(IMiramarPublisher publisher, IMiramarTaskProvider taskProvider, IMiramarScheduleProvider scheduleProvider, IMiramarContextProvider contextProvider) : this(taskProvider, scheduleProvider, contextProvider) { this.publisher = publisher; }
public MiramarTaskProvider(IMiramarPublisher publisher, TaskConfigurationModel[] collection) : this(collection) { this.publisher = publisher; }
public MiramarTaskProvider(TaskConfigurationModel[] collection) { this.collection = collection; publisher = new MiramarPublisher(); }