public static ProcessWrapper Create(EventStoreElement configuration) { if (configuration.Debug) { return new DebugProcessWrapper(configuration); } return new DefaultProcessWrapper(configuration); }
public static InstanceStrategy Create(EventStoreElement configuration) { switch (configuration.Arguments) { case ArgumentKind.Json: return new JsonConfigStrategy(); case ArgumentKind.CommandLine: return new CommandLineStrategy(); default: throw new ArgumentOutOfRangeException(); } }
public DefaultProcessWrapper(EventStoreElement configuration) { _instanceInfo = configuration.GetEventStoreInstanceInfo(); var startInfo = new ProcessStartInfo(_instanceInfo.FileName, _instanceInfo.Arguments) { RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false }; _process = new Process { StartInfo = startInfo, EnableRaisingEvents = true }; }
public EventStoreInstanceInfo GetInstanceInfo(EventStoreElement configuration) { string exe; switch (configuration.RunMode) { case RunMode.SingleNode: exe = "EventStore.SingleNode.exe"; break; case RunMode.Cluster: exe = "EventStore.ClusterNode.exe"; break; default: throw new ArgumentOutOfRangeException(); } string fileName = Path.Combine(configuration.BinaryPath, exe); string arguments = GenerateArguments(ReadConfiguration(configuration)); return new EventStoreInstanceInfo(fileName, arguments, OnStop); }
private IEnumerable<Argument> ReadConfiguration(EventStoreElement configuration) { IEnumerable<Argument> arguments = ReadConfigurationElement(configuration.Database); switch (configuration.RunMode) { case RunMode.SingleNode: arguments = arguments.Union(ReadConfigurationElement(configuration.SingleNode)); arguments = arguments.Union(ReadConfigurationElement(configuration.Projections)); break; case RunMode.Cluster: arguments = arguments.Union(ReadConfigurationElement(configuration.Cluster)); arguments = arguments.Union(ReadConfigurationElement(configuration.Projections)); break; default: throw new ArgumentOutOfRangeException(); } return arguments; }
public DebugProcessWrapper(EventStoreElement configuration) : base(configuration) { }