static void Main(string[] args) { // Instrumentation & Logging var observer = new HostObserverSubject(); observer.Subscribe(e => Console.WriteLine(e.Describe())); // Deployments var deploymentPath = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), @"..\..\Deployment"); var deploymentReader = new SimpleFileDeploymentReader(deploymentPath); // Host var context = new HostContext(observer, deploymentReader); var host = new Host(context, 5000); // START var cts = new CancellationTokenSource(); host.Run(cts.Token); Console.ReadKey(); // STOP cts.Cancel(); Console.ReadKey(); }
public Program() { _cts = new CancellationTokenSource(); var observer = new HostObserverSubject(); observer.Subscribe(Console.WriteLine); var basePath = Path.GetDirectoryName(typeof (Program).Assembly.Location); var fileDeploymentReader = new FileDeploymentReader(basePath, "head.xml"); var context = new HostContext(observer, fileDeploymentReader); _host = new Host(context); }
public Program() { _cts = new CancellationTokenSource(); var observer = new HostObserverSubject(); observer.OfType<HostStartedEvent>().Subscribe(e => Console.WriteLine("AppHost started.")); observer.OfType<HostStoppedEvent>().Subscribe(e => Console.WriteLine("AppHost stopped.")); observer.OfType<CellStartedEvent>().Subscribe(e => Console.WriteLine("Cell {0} started.", e.CellName)); observer.OfType<CellStoppedEvent>().Subscribe(e => Console.WriteLine("Cell {0} stopped.", e.CellName)); observer.OfType<CellExceptionRestartedEvent>().Subscribe(e => Console.WriteLine("Cell {0} exception: {1}", e.CellName, e.Exception)); observer.OfType<CellFatalErrorRestartedEvent>().Subscribe(e => Console.WriteLine("Cell {0} fatal error: {1}", e.CellName, e.Exception)); var path = Path.Combine(Path.GetDirectoryName(typeof (Program).Assembly.Location), "Deployments"); var deploymentReader = new FileDeploymentReader(path); var context = new HostContext(observer, deploymentReader); _host = new Host(context); }
static void Main(string[] args) { // Instrumentation & Logging var observer = new HostObserverSubject(); observer.Subscribe(e => Console.WriteLine(e.Describe())); // Deployments var deploymentReader = new DeploymentReader("UseDevelopmentStorage=true"); // Host var context = new HostContext(deploymentReader, observer); var host = new Host(context); // START var cts = new CancellationTokenSource(); host.Run(cts.Token); Console.ReadKey(); // STOP cts.Cancel(); Console.ReadKey(); }