Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var esCon = EventStoreConnection.Create(endpoint);
            esCon.Connect();

            var credentials = new UserCredentials("admin", "changeit");

            var adapter = new EventStoreAdapter(endpoint, credentials);

            //var cm = new CommandManager(esCon);
            //var pm = new ProjectionManager(endpoint, credentials, adapter);
            //pm.Run();


            //var cp = new MyDiagProjection(endpoint, credentials, adapter, "Budgets-1722f4ea_a9a5_4d97_8c39_c9d450a1331a");
            //cp.Start();
            //while (cp.HasLoaded == false)
            //    System.Threading.Thread.Sleep(100);

            //Console.WriteLine("done from all");
            //Console.ReadLine();

            var cp2 = new BudgetLinesProjection("Budgets-1722f4ea_a9a5_4d97_8c39_c9d450a1331a", endpoint, credentials, adapter, "lines_of_Budgets-1722f4ea_a9a5_4d97_8c39_c9d450a1331a" );
            cp2.Start();

            //var cp2 = new MyDiagProjection(endpoint, credentials, adapter, "Budgets-1722f4ea_a9a5_4d97_8c39_c9d450a1331a", "lines_of_Budgets-1722f4ea_a9a5_4d97_8c39_c9d450a1331a");
            //cp2.Start();
            while (cp2.HasLoaded == false)
                System.Threading.Thread.Sleep(100);
            
            Console.ReadLine();
            //var events = adapter.GetStreamEvents("");
            
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            var cs = ConnectionSettings.Create();

            var endpoint = new IPEndPoint(IPAddress.Loopback, 1113);
            var con = EventStoreConnection.Create(endpoint);
            con.ConnectAsync();

            var credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit");

            var adapter = new EventStoreAdapter(endpoint, credentials);
            ProjectionManager = new ProjectionManager(endpoint, credentials, adapter);
            ProjectionManager.Run();

            CommandManager = new CommandManager(con);

            //var binder = new DefaultModelBinder();
            //ModelBinders.Binders.Add(typeof(DateTime), binder);
            //ModelBinders.Binders.Add(typeof(DateTime?), binder);

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            userCredentials = new UserCredentials("admin", "changeit");

            address = new IPEndPoint(IPAddress.Loopback, 1113);
            var con = EventStoreConnection.Create(address);
            con.Connect();

            _adapter = new EventStoreAdapter(address, userCredentials);
            //CreateLines(1000000, con, "Users-5e3191f5_bb94_4074_b46b_9d4f8e4461b2");
            MeasureLines(con, userCredentials);
            // FromAll(con, userCredentials);
            //FromStream(con, userCredentials);
        }
Ejemplo n.º 4
0
        static void FromStream(IEventStoreConnection con, UserCredentials userCredentials)
        {
            var ad = new MyBudget.Infrastructure.EventStoreAdapter(address, userCredentials);

            // var sub = con.SubscribeToStreamFrom("$category-Users", null, true, Appeared, Live, Dropped, userCredentials);
            //   sub.Start();

            var read = con.ReadStreamEventsForward("lines_of_", 0, 1000, true, userCredentials);

            foreach (var e in read.Events)
            {
                var t = ad.TryGetDomainEvent(e);
            }
            var mre = new ManualResetEvent(false);

            mre.WaitOne(3000);

            var rgpsa = events.GroupBy(g => g.Event.EventId).ToList();
            int i     = 0;
            var rgps  = events.Select(s => new { s, position = i++ }).GroupBy(g => g.s.Event.EventId).ToList();

            //var rgps2 = read.Events.Select(s => new { s, position = i++ }).GroupBy(g => g.s.Event.EventId).ToList();

            foreach (var r in rgps)
            {
                var values = r.ToArray();

                foreach (var v in values)
                {
                    var t = ad.TryGetDomainEvent(v.s);
                }
            }


            Console.ReadLine();
        }
Ejemplo n.º 5
0
        static void FromStream(IEventStoreConnection con, UserCredentials userCredentials)
        {
            var ad = new MyBudget.Infrastructure.EventStoreAdapter(address, userCredentials);

            // var sub = con.SubscribeToStreamFrom("$category-Users", null, true, Appeared, Live, Dropped, userCredentials);
            //   sub.Start();

            var read = con.ReadStreamEventsForward("lines_of_", 0, 1000, true, userCredentials);

            foreach (var e in read.Events)
            {
                var t = ad.TryGetDomainEvent(e);

            }
            var mre = new ManualResetEvent(false);
            mre.WaitOne(3000);

            var rgpsa = events.GroupBy(g => g.Event.EventId).ToList();
            int i = 0;
            var rgps = events.Select(s => new { s, position = i++ }).GroupBy(g => g.s.Event.EventId).ToList();
            //var rgps2 = read.Events.Select(s => new { s, position = i++ }).GroupBy(g => g.s.Event.EventId).ToList();

            foreach (var r in rgps)
            {
                var values = r.ToArray();

                foreach (var v in values)
                {

                    var t = ad.TryGetDomainEvent(v.s);
                }
            }


            Console.ReadLine();
        }