public static void Main(string[] args) { ITransitionRepository transitions = new TransitionRepository(); IStatusRepository statuses = new StatusRepository(); ISubtypeRepository subtypes = new SubtypeRepository(); IStatusService service = new StatusService(transitions, statuses, subtypes); var initialDefaultStatuses = service.GetInitialStatuses(SubtypeRepository.DefaultSubtype); var initialValidationStatuses = service.GetInitialStatuses(SubtypeRepository.ValidationSubtype); Console.WriteLine("------ Initial Default Statuses ------"); foreach (var defaultStatus in initialDefaultStatuses) { Console.WriteLine(defaultStatus); } Console.WriteLine("------ Initial Validation Statuses ------"); foreach (var validationStatus in initialValidationStatuses) { Console.WriteLine(validationStatus); } Console.ReadLine(); }
public void Start() { OutputWriter.WriteLine("PAQK.Reply"); OutputWriter.WriteLine("---------"); OutputWriter.WriteLine(" Events Database:"); OutputWriter.WriteLine(" {0}", Settings.MongoEventsConnectionString); OutputWriter.WriteLine(" View Database:"); OutputWriter.WriteLine(" {0}", Settings.MongoViewConnectionString); if (InputReader != null) { OutputWriter.WriteLine(); OutputWriter.WriteLine(); OutputWriter.WriteLine("Are you sure that you want to drop these databases? (type 'yes' or 'no')"); OutputWriter.WriteLine(" {0}", Settings.MongoViewConnectionString); OutputWriter.Write("> "); var answer = InputReader.ReadLine(); if (String.Compare(answer, "yes", StringComparison.OrdinalIgnoreCase) != 0) { return; } } try { BeforeReplayPreparations(); UniformDatabase.EnterInMemoryMode(); var transitions = TransitionRepository.GetTransitions(); var stopwatch = Stopwatch.StartNew(); var counter = 0; foreach (var transition in transitions) { foreach (var evnt in transition.Events) { if (++counter % 10000 == 0) { OutputWriter.WriteLine("Events #{0:n0}", counter); } DispatchAsync((IEvent)evnt.Data); } } OutputWriter.WriteLine("Waiting for dispatch completion..."); WaitForDispatchCompletion(); OutputWriter.WriteLine("Flushing..."); UniformDatabase.LeaveInMemoryMode(true); stopwatch.Stop(); OutputWriter.WriteLine("Flush completed"); var message = String.Format("Replayed in {0}. Total number of events {1:n0}", stopwatch.Elapsed.ToReadableString(), counter); logger.Info(message); OutputWriter.WriteLine(message); if (InputReader != null) { InputReader.ReadKey(); } } catch (Exception ex) { logger.Fatal(ex); OutputWriter.WriteLine(ex.Message); } }
public TransitionController(TransitionRepository transitionRepository) { _transitionRepository = transitionRepository; }