Exemple #1
0
 public Worker(string sourceName, SyncroniserService inMemorySynchroniser, ReadModels.Elastic.SyncroniserService elasticSynchroniser, Handler handler)
 {
     _sourceName           = sourceName;
     _inMemorySynchroniser = inMemorySynchroniser;
     _elasticSynchroniser  = elasticSynchroniser;
     _handler = handler;
     InitReadModels();
 }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                var eventStore = "tcp://localhost:1113";
                if (args.Length > 0)
                {
                    eventStore = args[0];
                }
                _eventStoreUri = new Uri(eventStore);
                if (args.Length > 1)
                {
                    _elasticSearchUri = new Uri(args[1]);
                }

                var inMemorySynchronizer = new ReadModels.InMemory.SyncroniserService(BuildConnection("taskzero-synchronizer-inmemory", _eventStoreUri),
                                                                                      new UserCredentials("admin", "changeit"));
                ReadModels.Elastic.SyncroniserService elasticSearchSynchronizer = null;
                if (_elasticSearchUri != null)
                {
                    elasticSearchSynchronizer = new ReadModels.Elastic.SyncroniserService(BuildConnection("taskzero-synchronizer-elastic", _eventStoreUri),
                                                                                          new UserCredentials("admin", "changeit"), new ReadModels.Elastic.Indexer <ReadModels.Elastic.Model.ZeroTask>(2000,
                                                                                                                                                                                                       new ElasticClient(_elasticSearchUri), "taskzero-tasks"));
                }
                var commandsHandler =
                    new Handler(new EventStoreDomainRepository("domain",
                                                               BuildConnection("es-taskzero-domain", _eventStoreUri, true)));
                new Worker("TaskZero.Console", inMemorySynchronizer, elasticSearchSynchronizer, commandsHandler).Run();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.GetBaseException().Message);
            }
            Console.WriteLine("Press enter to exit");
            Console.ReadLine();
        }