示例#1
0
        static void Main(string[] args)
        {
            EventStoreLoader.SetupEventStore(EventStoreLoader.StartConflictOption.Connect);
            var connection = EventStoreLoader.Connection;

            var bus   = new FakeBus();
            var queue = new ReadmodelPublisher();



            var orderCreatedHandler = new CreateOrderCommandHandler(
                new Repository <Order>(
                    new Disruptor.ReadModel.Tests.Infrastructure.EventStore(connection, queue)));
            var orderItemAddedHandler = new AddItemToOrderCommandHandler(
                new Repository <Order>(
                    new Disruptor.ReadModel.Tests.Infrastructure.EventStore(connection, queue)));

            bus.RegisterAsyncHandler <CreateOrderCommand>(orderCreatedHandler.HandleAsync);
            bus.RegisterAsyncHandler <AddItemToCardCommand>(orderItemAddedHandler.HandleAsync);


            TestSendCommandAndFillupReadmodel(queue, bus);

            EventStoreLoader.TeardownEventStore(false, true);
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Setup EventStore");
            EventStoreLoader.SetupEventStore();

            ActorSystem.Create("ras").WhenTerminated.Wait();
        }
示例#3
0
        public GetEventStoreRepositoryIntegrationTests()
        {
            var es = new EventStoreLoader();

            es.SetupEventStore(new DirectoryInfo(@"C:\Program Files\PerkinElmer\Greylock\EventStore"));
            _connection = EventStoreConnection.Create(IntegrationTestTcpEndPoint);
            _connection.ConnectAsync().Wait();
            _repo = new ReactiveDomain.EventStore.GetEventStoreRepository(_connection);
        }
示例#4
0
        public static void Configure(IGeneralBus bus)
        {
            _es = new EventStoreLoader();
            _es.SetupEventStore(new DirectoryInfo(@"C:\Users\rosed18169\source\EventStore-OSS-Win-v3.9.4"));
            _esConnection = _es.Connection;
            _esRepository = new GetEventStoreRepository(_es.Connection);
            Locator.CurrentMutable.RegisterConstant(_esRepository, typeof(IRepository));

            _acctSvc = new AccountSvc(bus, _esRepository);
        }
        protected override void Given()
        {
            TcpEndPointConnection = EventStoreConnection.Create(IntegrationTestTcpEndPoint);
            EventStore            = new EventStoreLoader();

            TcpEndPointConnection.ConnectAsync().Wait();

            //TODO: better path!  Tacky because PerkinElmer\Greylock...
            EventStore.SetupEventStore(
                new DirectoryInfo(
                    @"c:\program files\PerkinElmer\Greylock\eventStore"));

            Repo = new GetEventStoreRepository(EventStore.Connection);
        }
示例#6
0
        static void Main(string[] args)
        {
            EventStoreLoader.SetupEventStore();
            var eventReader = new EventReader("Payments");
            var eventWriter = new EventWriter("CounterResults");

            eventReader.ConnectToPersistentSubscription("Payments", "Payments_Counter", (_, e) =>
            {
                var data = Encoding.ASCII.GetString(e.Event.Data);
                switch (e.Event.EventType)
                {
                case "PaymentStatusChanged":
                    var pscmessage    = data.ParseJson <PaymentStatusChangedMessage>();
                    var calculator    = new CustomerPaymentCounterCalculator();
                    var result        = calculator.GetPaymentChanges(pscmessage);
                    var eReader1      = new EventReader($"evt-{pscmessage.Payment.PaymentReference}");
                    var allMessages   = eReader1.ReadAllMessages(pscmessage.Payment.PaymentReference);
                    var counterResult = new CounterResult {
                        CustomerReference = pscmessage.Customer.CustomerReference, PaymentReference = pscmessage.Payment.PaymentReference, Increment = result
                    };
                    eventWriter.WriteEvent(counterResult.AsJsonString(), "IncrementCalculated");
                    Console.WriteLine($"**Event received for payment {pscmessage.Payment.PaymentReference}");
                    break;

                case "ApprovalStatusChanged":
                    var asmessage = data.ParseJson <PaymentApprovalStatusChangedMessage>();
                    break;

                case "CustomerAccountChanged":
                    var camessage = data.ParseJson <PaymentCustomerAccountChangedMessage>();
                    break;

                case "WithdrawalChannelChanged":
                    var wcmessage = data.ParseJson <WithdrawalChannelChangedMessage>();
                    break;

                default:
                    Console.WriteLine("Cannot parse event type");
                    return;
                }
            });

            Console.ReadLine();
        }