public void Execute(BootstrapSettings bootstrapSettings)
 {
     Log.WriteRuntimeInfo();
     ApplySettings(bootstrapSettings);
     PrepareSubscriptionsForPendingJobs();
     LaunchComputationalUnits();
     PublishJobs();
 }
 public void Execute(string bootstrapFileName)
 {
     var bootstrapSettings = new BootstrapSettings();
     using (var stream = new FileStream(bootstrapFileName, FileMode.Open, FileAccess.Read))
     {
         bootstrapSettings.LoadFrom(stream);
     }
     Execute(bootstrapSettings);
 }
        public void Initialize(BootstrapSettings settings)
        {
            Settings = settings;

            AttachedDispatchers.Clear();
            AttachedDispatchers.AddRange(Settings.DispatcherSettings.Select(d => d.DispatcherId));

            SubscribeToDetachDispatcherRequests();
            SubscribeToDispatcherLifeSignals();
        }
 public BootstrapSettings Clone()
 {
     var clone = new BootstrapSettings(
         DispatcherSettings.Select(s => s.Clone()).ToList(),
         BootstrapJobs.Select(r => r.Clone()).ToList()
     )
     {
         LaunchTimeout = LaunchTimeout
     };
     return clone;
 }
        public void ConfigureSupervisorFor(string dispatcherId)
        {
            var dispatcherSettings = ConfigureDispatcherFor(dispatcherId);

            var bootstrapSettings = new BootstrapSettings();
            bootstrapSettings.DispatcherSettings.Add(dispatcherSettings);

            SubscribeToDispatcherOffLineEvent();
            SubscribeToDispatcherOnLineEvent();

            Supervisor.Initialize(bootstrapSettings);
        }
 public StepsContext()
 {
     DependencyResolver.Reset();
     DependencyResolver.Initialize();
     DispatcherLifeSpan = new DispatcherLifeSpan
     {
         Mode = DispatcherLifeSpanMode.UntilTimedOut,
         Timeout = TimeSpan.FromSeconds(10)
     };
     BootstrapSettings = new BootstrapSettings();
     BootstrapperSettingsStream = new MemoryStream();
 }
        public StepsContext()
        {
            DependencyResolver.Reset();
            DependencyResolver.Initialize();
            DispatcherLifeSpan = new DispatcherLifeSpan
            {
                Mode = DispatcherLifeSpanMode.UntilTimedOut,
                Timeout = TimeSpan.FromSeconds(10)
            };
            BootstrapSettings = new BootstrapSettings();
            SubscriptionBus = DependencyResolver.Get<ISubscriptionBus>();
            JobsExecuted = new List<Type>();
            Launcher = DependencyResolver.Get<DispatcherLauncher>();
            Bootstrapper = DependencyResolver.Get<Bootstrapper>();

            ClearAmqpResources();
        }
 public StepsContext()
 {
     DependencyResolver.Reset();
     DependencyResolver.Initialize();
     DispatcherLifeSpan = new DispatcherLifeSpan
     {
         Mode = DispatcherLifeSpanMode.UntilTimedOut,
         Timeout = TimeSpan.FromSeconds(10)
     };
     BootstrapSettings = new BootstrapSettings();
     SendingBus = DependencyResolver.Get<ISendingBus>();
     ReceivingBus = DependencyResolver.Get<IReceivingBus>();
     Bootstrapper = DependencyResolver.Get<Bootstrapper>();
     LatestLifeSignals = new Dictionary<string, LifeSignal>();
     MaxTimeDispatcherCanBeSilent = TimeSpan.FromSeconds(5);
     ClearAmqpResources();
 }
        public static void Start(string bootstrapFileName)
        {
            if (!File.Exists(bootstrapFileName))
                throw new ArgumentException("Bootstrap file could not be found!");

            DependencyResolver.Reset();
            DependencyResolver.Initialize();

            Supervisor = DependencyResolver.Get<Supervisor>();

            var bootstrapSettings = new BootstrapSettings();
            using (var stream = new FileStream(bootstrapFileName, FileMode.Open, FileAccess.Read))
            {
                bootstrapSettings.LoadFrom(stream);
            }

            Supervisor.Initialize(bootstrapSettings);
            Supervisor.IsComputationalUnitRestorationEnabled = true;
            Supervisor.Bootstrap();
        }
        public StepsContext()
        {
            DependencyResolver.Reset();
            DependencyResolver.Initialize();

            DispatcherLifeSpan = new DispatcherLifeSpan
            {
                Mode = DispatcherLifeSpanMode.UntilTimedOut,
                Timeout = TimeSpan.FromSeconds(15)
            };
            BootstrapSettings = new BootstrapSettings();

            WorkDispatchersOnline = new List<DispatcherId>();
            WorkDispatchersRestarted = new List<DispatcherId>();

            SubscriptionBus = DependencyResolver.Get<ISubscriptionBus>();
            SendingBus = DependencyResolver.Get<ISendingBus>();
            Supervisor = DependencyResolver.Get<Supervisor>();

            ClearAmqpResources();
        }
 private void ApplySettings(BootstrapSettings bootstrapSettings)
 {
     // Clone settings to avoid side effect in case the reference is changed afterwards
     BootstrapSettings = bootstrapSettings.Clone();
 }